Hi,
I am trying to generate a random number in a listbox (client_list) on a Windows form. For this I have included a timer control. The program runs but does not show any output. I have set Enabled property of the timer control to True and set the interval to 5 and set the events property to timerprices_Tick. Could someone help me out?
private void timerprices_Tick(object sender,
System.EventArgs e)
{
int counter = 0;
Random r = new Random();
if (counter < 3)
{
String stprices_list =
r.Next(0,200).ToString("000");
client_list.Items.Add(stprices_list);
counter = counter + 1;
}
else
{
timerprices.Enabled = false;
counter = 0;
}
}
Thanks a lot
I am trying to generate a random number in a listbox (client_list) on a Windows form. For this I have included a timer control. The program runs but does not show any output. I have set Enabled property of the timer control to True and set the interval to 5 and set the events property to timerprices_Tick. Could someone help me out?
private void timerprices_Tick(object sender,
System.EventArgs e)
{
int counter = 0;
Random r = new Random();
if (counter < 3)
{
String stprices_list =
r.Next(0,200).ToString("000");
client_list.Items.Add(stprices_list);
counter = counter + 1;
}
else
{
timerprices.Enabled = false;
counter = 0;
}
}
Thanks a lot