simple code to change the background colour of the labels in the form when the user presses the "go" command button, it just hang forever thou and doesn't even go into the loop, i dont need an exit condition either just a normal user close, can anyone suggest why this seemlingly easy code peice does not work?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Suthish NairRank #92 · 22.8K reputationPosted Aug 20, 2010, 9:49 AM EDT
+1
Put a breakpoint and check the value you getting for object number. If the number is always less than 10, then use random.Next(0, 10). First of all you need to redine your logic..
Code
Code
int i = 0;
while (i < 10)
{
i = i + 1;
int number = random.Next(0, 10);
..........
}
otherwise your code will execute in infinite loop..
+1
Sam HobbsRank #108 · 20.5K reputationPosted Aug 20, 2010, 11:23 AM EDT
+1
Are you sure it does not go ito the loop? It probably does.
Suthish NairRank #92 · 22.8K reputationPosted Aug 20, 2010, 9:49 AM EDT
If the number is always less than 10, then use random.Next(0, 10).
First of all you need to redine your logic..
..........
}
otherwise your code will execute in infinite loop..
Sam HobbsRank #108 · 20.5K reputationPosted Aug 20, 2010, 11:23 AM EDT