Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

stuck in a vb do loop

Hello from a newbie,
I can't figure out why I can't get out of my do while loop, please look at following code:

Public Sub cmdStart_Click()
Dim data As Variant

Do While cmdStart.Value = True
CWAIPoint1.SingleRead data
CWGraph1.ChartY data
DoEvents
Loop

End Sub

I can click on the button while the loop is executing, but the value won't change to false. I think this is probably more of a vb question, but any suggestions are greatly appreciated.

thanks,
Brian
0 Kudos
Message 1 of 2
(3,124 Views)
The problem is that the VB CommandButton control does not change its value by clicking on the control. For example, create a new VB project, drop a CommandButton on the form, double-click on the button, and add the following code:

Private Sub Command1_Click()
MsgBox Command1.Value
End Sub

Notice that the MsgBox displays "True" every time that you click the control. Try using CWButton instead of CommandButton.

- Elton
Message 2 of 2
(3,124 Views)