hello... i need help with making my outer whileloop runs slower than the inner while loop...
to make them that both runs at the same moment, i have used continue method...
but when i compile, the inner loop runs with the same rate as outer one...i have used thread.sleep(1000) for outer loop and thread.sleep(1) for inner loop... when i compile, the innner loop goes each second instead of each milisecond.. my continue make the inner loop dependent on outer loop... appreciate any help...
the codes are:
- while (t == true)
- {
- try {
- cd.TimeTick();//tick time
- lblTime.Text = cd.GetTime();//put time
- Thread.Sleep(1000); //delay with one second
- Application.DoEvents();
- while (tLu == true)
- {
- try {
- cdLu.TimeTick();//tick time
- lblLunch.Text = cdLu.GetTime();//put time
- Thread.Sleep(1); //delay with one milisecond
- Application.DoEvents();
- throw new Exception();
- }
- catch (Exception)
- {
- throw new Continue();
- }
- }
- [Serializable]
- internal class Continue : Exception
- {
- public Continue()
- {
- }
- public Continue(string message) : base(message)
- {
- }
- public Continue(string message, Exception innerException) : base(message, innerException)
- {
- }
- protected Continue(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }

Amit GuptaRank #190 · 12.8K reputationPosted Mar 3, 2019, 7:45 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Mar 3, 2019, 7:47 AM EST
venus najadRank #2,456 · 573 reputationPosted Mar 3, 2019, 7:51 AM EST
venus najadRank #2,456 · 573 reputationPosted Mar 3, 2019, 7:52 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Mar 3, 2019, 8:06 AM EST
venus najadRank #2,456 · 573 reputationPosted Mar 3, 2019, 8:09 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Mar 3, 2019, 6:23 PM EST
venus najadRank #2,456 · 573 reputationPosted Mar 8, 2019, 8:48 AM EST