G
Guest
Hi all,
I hope I have found the right group to post this question to, if not please
point me in the right direction.
I have VB.net 2003 and need to make a button that performs an action only
when pressed and the action STOP when the button is released.
I have tried putting the following into the program:
Private Sub btnFocusPlus_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles btnFocusPlus.MouseDown
'Check if port open
Dim x As Integer
If Not ComPortOpen = 1 Then
Beep()
WriteMessage("No Port Open")
Exit Sub
End If
For x = 1 To 5
If not btnFocusPlus.MouseButtons.Left Then
Exit Sub
Else
'Lengthen the Focus 10 point
LV = 50
m_CommPort.Write("Mf-" + LV & Chr(13))
End If
Next
End Sub
This basically sends a command "Mf-50" to the COM port for a loop of 5 times
each time the button is pressed down. I want to break the loop if the button
is released.
I just can't seem to find something like Button Up.
Any ideas or help greatly acknowledged.
--
Cheers
Chas
***************
* Spectrum is Green *
***************
I hope I have found the right group to post this question to, if not please
point me in the right direction.
I have VB.net 2003 and need to make a button that performs an action only
when pressed and the action STOP when the button is released.
I have tried putting the following into the program:
Private Sub btnFocusPlus_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles btnFocusPlus.MouseDown
'Check if port open
Dim x As Integer
If Not ComPortOpen = 1 Then
Beep()
WriteMessage("No Port Open")
Exit Sub
End If
For x = 1 To 5
If not btnFocusPlus.MouseButtons.Left Then
Exit Sub
Else
'Lengthen the Focus 10 point
LV = 50
m_CommPort.Write("Mf-" + LV & Chr(13))
End If
Next
End Sub
This basically sends a command "Mf-50" to the COM port for a loop of 5 times
each time the button is pressed down. I want to break the loop if the button
is released.
I just can't seem to find something like Button Up.
Any ideas or help greatly acknowledged.
--
Cheers
Chas
***************
* Spectrum is Green *
***************