|
-
May 15th, 2004, 01:21 AM
#1
Thread Starter
New Member
is there any way to stop DoEvents
hi.. is there any way to stop do event??? my program keeps on executing do events even it pass through an exit sub
-
May 15th, 2004, 01:25 AM
#2
What do you mean? DoEvents doesn't really process it allows everything else to process? Is it a loop you are trying to stop?
-
May 15th, 2004, 03:04 AM
#3
Thread Starter
New Member
instart=0
intend=32
While blnLoop = True
For intOsci = intStart To intEnd Step intStep
'Send2Remote(strUserID, cboOnline.Text, "motor1 " & intOsci + intStartAt))
Write("motor1 " & intOsci + intStartAt)
If intOsci + intStartAt = intEnd Then
intTemp = intEnd
intEnd = intStart
intStart = intTemp
intStep = -(intStep)
intStartAt = -(intStartAt)
'reverse
If intOsci - intStartAt = 0 Then
intStart = 0
intEnd = -(intEnd)
intStep = -(intStep)
intStartAt = -(intStartAt)
End If
End If
If objShaft = 0.0 Then
Write("motor1 0")
blnLoop = False
Exit Sub
End If
System.Threading.Thread.CurrentThread.Sleep(intInterval)
System.Windows.Forms.Application.DoEvents()
Next
End While
heres my loop.. i keeps on runinng because of the doevents
-
May 15th, 2004, 06:31 AM
#4
PowerPoster
Hi,
Have a look at the following thread.
http://www.vbforums.com/showthread.p...hreadid=289949
Use the code suggested by Janis
I.E. place a button on your form which will vary the status of a boolean which is checked every time the loop is continued.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 15th, 2004, 01:07 PM
#5
DoEvents can't keep your loop running. It probably keeps running because blnLoop never equals False. You should step through it and check the values.
-
May 15th, 2004, 04:44 PM
#6
PowerPoster
Hi edneeis,
"It probably keeps running because blnLoop never equals False."
Whether or not blnLoop is fals, that will NOT affect his loop.
Hi dimonique,
When I referred you to the other thread a did not look at your code.
Your loop will only exit if objShaft = 0.0 (i.e. =0)
Now, I find it difficult to imagine any object equalling 0.0
objShaft COULD = Nothing but not 0.0
objShaft.Text COULD equal "0.0" but that is unlikely.
You could have created your own class with a property which might = 0.0, but you would have to refer to that property.
I'm just guessing but I hope it helps.
Last edited by taxes; May 15th, 2004 at 04:48 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|