Click here to Skip to main content
15,887,585 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Help... Again... Pin
Wes Aday20-Apr-14 8:36
professionalWes Aday20-Apr-14 8:36 
GeneralRe: Help... Again... Pin
Tino Fourie24-Apr-14 7:00
Tino Fourie24-Apr-14 7:00 
QuestionAbout handling MSComm events in VB6 Pin
Member 1056890820-Apr-14 5:20
Member 1056890820-Apr-14 5:20 
AnswerRe: About handling MSComm events in VB6 Pin
Eddy Vluggen21-Apr-14 8:18
professionalEddy Vluggen21-Apr-14 8:18 
GeneralRe: About handling MSComm events in VB6 Pin
Member 1056890821-Apr-14 14:27
Member 1056890821-Apr-14 14:27 
GeneralRe: About handling MSComm events in VB6 Pin
Eddy Vluggen21-Apr-14 22:33
professionalEddy Vluggen21-Apr-14 22:33 
GeneralRe: About handling MSComm events in VB6 Pin
Nicholas Marty22-Apr-14 0:06
professionalNicholas Marty22-Apr-14 0:06 
GeneralRe: About handling MSComm events in VB6 Pin
Member 105689083-May-14 21:41
Member 105689083-May-14 21:41 
Hello Nicholas,

I would like to thank you so much for your help and your explanation.
I've tried your code and it explains clearly what the DoEvents instruction does. Actually I wasn't understanding how it works, so your code really helped me out.

Additionally, I've modified it to better understanding, and I think the execution of the code below shows that the events are queued as you've said.

VB
Example: A VB6 application with 2 Command Buttons.

Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
   Debug.Print "Begin Command1"
   Do
      c = c + 1
      Sleep 500
      DoEvents
   Loop Until c = 10
   Debug.Print "End Command1"
End Sub

Private Sub Command2_Click()
   Debug.Print "Begin Command2"
   Do
      c = c + 1
      Sleep 500
      DoEvents
   Loop Until c = 10
   Debug.Print "End Command2"   
End Sub


When you click in one Command, the program waits for 5 seconds before the "End Command" message appears. When you click on the first then the second, what happens is that :
Begin Command1
Begin Command2
End Command2
End Command1

The whole execution takes 10 seconds. Which means that when raising the command2 event, the execution of command1 code has stopped and waited until the command2 code has finished to be resumed.

This confirms also that it's not multi-threaded as Eddy Vluggen has said.

Thank you all for your help and interaction.
QuestionRounding To 2 Decimal Places Pin
Member 1072866719-Apr-14 16:46
Member 1072866719-Apr-14 16:46 
AnswerRe: Rounding To 2 Decimal Places Pin
Richard MacCutchan19-Apr-14 21:22
mveRichard MacCutchan19-Apr-14 21:22 
QuestionQueue and Stack Pin
DJHJr17-Apr-14 8:04
DJHJr17-Apr-14 8:04 
AnswerRe: Queue and Stack Pin
Eddy Vluggen17-Apr-14 8:31
professionalEddy Vluggen17-Apr-14 8:31 
GeneralRe: Queue and Stack Pin
DJHJr17-Apr-14 9:07
DJHJr17-Apr-14 9:07 
GeneralRe: Queue and Stack Pin
Eddy Vluggen17-Apr-14 10:24
professionalEddy Vluggen17-Apr-14 10:24 
Questionfilesystemwatcher possible infinite loop Pin
Tony Snowden17-Apr-14 0:20
Tony Snowden17-Apr-14 0:20 
AnswerRe: filesystemwatcher possible infinite loop Pin
Richard Andrew x6417-Apr-14 0:45
professionalRichard Andrew x6417-Apr-14 0:45 
GeneralRe: filesystemwatcher possible infinite loop Pin
Tony Snowden17-Apr-14 1:07
Tony Snowden17-Apr-14 1:07 
QuestionHow to Run Transparent Flash Files Over a Running Video in VB Pin
NAVEEN SONI16-Apr-14 17:56
NAVEEN SONI16-Apr-14 17:56 
QuestionPass a string to a control on a form from a remoting connection Pin
ParadoxLiving15-Apr-14 20:27
ParadoxLiving15-Apr-14 20:27 
AnswerRe: Pass a string to a control on a form from a remoting connection Pin
Alan N16-Apr-14 4:48
Alan N16-Apr-14 4:48 
GeneralRe: Pass a string to a control on a form from a remoting connection Pin
ParadoxLiving16-Apr-14 16:07
ParadoxLiving16-Apr-14 16:07 
QuestionStart another process as admin Pin
Dominick Marciano15-Apr-14 3:52
professionalDominick Marciano15-Apr-14 3:52 
AnswerRe: Start another process as admin Pin
Bernhard Hiller15-Apr-14 22:25
Bernhard Hiller15-Apr-14 22:25 
GeneralRe: Start another process as admin Pin
Dominick Marciano16-Apr-14 8:22
professionalDominick Marciano16-Apr-14 8:22 
GeneralRe: Start another process as admin Pin
Dave Kreskowiak16-Apr-14 9:41
mveDave Kreskowiak16-Apr-14 9:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.