Hi, in recent days, I've been admonished for using two commands: 'My.Application.DoEvents' and 'End'.
If they are so bad why are they still available?
Ok... I have a project, at the end of which, or if there's a user error; I want to display a short message and close the program. I do not want to use a MessageBox because I just want the program to close down, on it's own after just five seconds without intervention from the user... No buttons.
I'm not bothered that everything is put on hold for those five seconds because this program only runs once as a 'Start Up' program, and five seconds is a drop in the ocean these days compared to the time it takes my machine to boot-up.
'No No' 1: The process has to be able to 'see' the Timer1.Tick so I call: My.Application.DoEvents() while it waits.
'No No' 2: When the timer 'ticks' Timer1 is disabled and the While Loop completes... Fine, so what's next? Me.Close(), close the program: Right ? Does the program close? NO... It just carries on as if nothing had said Stop. So... I add the second 'No No': End... Problem solved.
Where's the harm ? What's so tragic ?
Poppa.
If they are so bad why are they still available?
Ok... I have a project, at the end of which, or if there's a user error; I want to display a short message and close the program. I do not want to use a MessageBox because I just want the program to close down, on it's own after just five seconds without intervention from the user... No buttons.
I'm not bothered that everything is put on hold for those five seconds because this program only runs once as a 'Start Up' program, and five seconds is a drop in the ocean these days compared to the time it takes my machine to boot-up.
'No No' 1: The process has to be able to 'see' the Timer1.Tick so I call: My.Application.DoEvents() while it waits.
'No No' 2: When the timer 'ticks' Timer1 is disabled and the While Loop completes... Fine, so what's next? Me.Close(), close the program: Right ? Does the program close? NO... It just carries on as if nothing had said Stop. So... I add the second 'No No': End... Problem solved.
Where's the harm ? What's so tragic ?
vb.net Code:
Poppa.