C# Programming
04-02-2009, 07:53 PM
Hello,
I've got an easy on for you all.
Since I chose to have input of QueryTime possibly be a decimal (ex ".5"), I have kept it a decimal.
However, Timer.Interval is an int and I need to convert a decimal to an int.
public void StartTimer(decimal QueryTime) // decimal QueryTime = 0.5
{
int shizz = Decimal.ToInt32(QueryTime); // int shizz = 0
int wtf = (Decimal.ToInt32(QueryTime) * 60) * 1000; // int wtf = 0
QueryTimer.Interval = ((int)QueryTime * 60)* 1000;
QueryTimer.Enabled = true;
}
Event when QueryTime = 0.5, both shizz and wtf are 0.
Does anyone know how to properly convert a decimal to an integer?
Thanks,
Matt
I've got an easy on for you all.
Since I chose to have input of QueryTime possibly be a decimal (ex ".5"), I have kept it a decimal.
However, Timer.Interval is an int and I need to convert a decimal to an int.
public void StartTimer(decimal QueryTime) // decimal QueryTime = 0.5
{
int shizz = Decimal.ToInt32(QueryTime); // int shizz = 0
int wtf = (Decimal.ToInt32(QueryTime) * 60) * 1000; // int wtf = 0
QueryTimer.Interval = ((int)QueryTime * 60)* 1000;
QueryTimer.Enabled = true;
}
Event when QueryTime = 0.5, both shizz and wtf are 0.
Does anyone know how to properly convert a decimal to an integer?
Thanks,
Matt