
VB 6.0 vs. VB.Net Event Termination
I have detected a difference between VB 6.0 and VB.Net that I have not seen
documented. Hang with me, as this gets a bit involved. I have two buttons
... Button1 and Button2. The click event for Button1 goes off to a
subroutine that goes into a loop from which it does not exit until a Boolean
variable goes False; the loop within the subroutine does a Doevents
[DoEvents() in the case of VB 6.0 and
System.Windows.Forms.Application.DoEvents() in the case of VB.Net]
frequently (in order to see if Button2 has been clicked). The Button2 click
event sets that Boolean variable to false ... and thus the subroutine that
Button1 invoked will exit. Now, in VB 6.0 after clicking Button1 and
watching the program do its thing for awhile I then click Button2 (once) and
the program stops doing its thing ... exactly as I want it to do. In VB.Net
I have to hit Button2 TWO times in order for the program to "see" it. I
suspect that this has to do with the fact that the Button1 click event
routine has not been exited from before I first click Button2 ... because
I'm still in the looping subroutine. A curious aside ... if, after starting
things going by clicking Button1, I right click some empty area of the
window and THEN left click Button2 it works.
I cannot find in the on-line VB.Net help documentation any mention of this
... I'm sure it's buried in there somewhere but I haven't found it.
so active any public reply won't last very long!
Thanks very much.