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)
- {
- }
- }
venus najadPosted Mar 8, 2019, 1:48 PM
Amit GuptaPosted Mar 3, 2019, 11:23 PM
venus najadPosted Mar 3, 2019, 1:09 PM
Amit GuptaPosted Mar 3, 2019, 1:06 PM
venus najadPosted Mar 3, 2019, 12:52 PM
venus najadPosted Mar 3, 2019, 12:51 PM
Amit GuptaPosted Mar 3, 2019, 12:47 PM
Amit GuptaPosted Mar 3, 2019, 12:45 PM