VB 6.0 vs. VB.Net Event Termination 
Author Message
 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.



Tue, 03 May 2005 03:00:20 GMT  
 VB 6.0 vs. VB.Net Event Termination
This does reproduce, but I believe it's a by design difference between VB6 &
VB.NET.

In VB.NET there is more flexibility and control of the Mouse Capture, you
can simply do the following:

' Release the capture of the button.
Button1.Capture = FALSE

Inside the event procedure before going into your doevents loop....

Thanks
Gary Spangler [MS]
--
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:
> 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.



Tue, 03 May 2005 05:52:55 GMT  
 VB 6.0 vs. VB.Net Event Termination
By gosh ... that worked!  Thanks a lot for the help.  I will look further
but in a cursory look since getting your message I do not see any reference
to the CAPTURE property in the Help documentation.

I have really enjoyed VB 6.0 for the past year and now I am learning that
VB.Net is a MUCH different animal.  I have so-o-o-o much to learn.



Quote:
> This does reproduce, but I believe it's a by design difference between VB6
&
> VB.NET.

> In VB.NET there is more flexibility and control of the Mouse Capture, you
> can simply do the following:

> ' Release the capture of the button.
> Button1.Capture = FALSE

> Inside the event procedure before going into your doevents loop....

> Thanks
> Gary Spangler [MS]
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.


> > 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.


is
> > so active any public reply won't last very long!

> > Thanks very much.



Tue, 03 May 2005 06:50:33 GMT  
 VB 6.0 vs. VB.Net Event Termination
To be honest so do I..... I just found that in the Object Browser attached
to the CONTROL as I was reproducing the difference you found.

If you bring up help and search for the Control Class
(System.windows.forms), and look at all members you'll find it listed.

Thanks
Gary Spangler [MS]

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:
> By gosh ... that worked!  Thanks a lot for the help.  I will look further
> but in a cursory look since getting your message I do not see any
reference
> to the CAPTURE property in the Help documentation.

> I have really enjoyed VB 6.0 for the past year and now I am learning that
> VB.Net is a MUCH different animal.  I have so-o-o-o much to learn.



> > This does reproduce, but I believe it's a by design difference between
VB6
> &
> > VB.NET.

> > In VB.NET there is more flexibility and control of the Mouse Capture,
you
> > can simply do the following:

> > ' Release the capture of the button.
> > Button1.Capture = FALSE

> > Inside the event procedure before going into your doevents loop....

> > Thanks
> > Gary Spangler [MS]
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.


> > > 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.


newsgroup
> is
> > > so active any public reply won't last very long!

> > > Thanks very much.



Wed, 04 May 2005 04:14:34 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Upgrading from VB 6.0 Professional to VS.NET

2. Newbie confused: VB6 vs VB.Net vs VBScript vs VBA

3. Newbie confused: VB6 vs VB.Net vs VBscript vs VBA

4. VB 6.0 reports vs. Crystal 6.0

5. VB 6.0 reports vs. Crystal 6.0

6. VB 6.0 with VS 6.0 and Access 2000

7. VB 6.0 with VS 6.0 and Access 2000

8. BUG: Problems with MDAC20.Cab Shipping in VS 6.0 and VB 6.0

9. VS.Net + Cr.Net and VB.Net

10. asp.dll - VB 5.0 vs. VB 6.0

11. VB 5.0 vs. VB 6.0 - ASP.DLL

 

 
Powered by phpBB® Forum Software