Link to home
Start Free TrialLog in
Avatar of wendilim
wendilim

asked on

mouse clicking

Hi,
I'm a student and i am doing a project on Visual Basic 6 which connect to a slider. I have 4 buttons-Home,Left,Right and Exit. if i click on Home button the slider(actuator)will move to the original place which is position 0. when i click on the Left button, the slider will move to position 200.when i click left button again, the slider will move from position 200 to 220, but the slider did not move to position 220, so how can i made the slider move to the position when i press the 2nd times
this is my program....... pls help.........

Private Sub cmdexit_Click()
End
     
End Sub

Private Sub cmdhome_Click()

outslider$ = "!99HOM0130@@" & Chr$(13) & Chr$(10)
If MSComm1.PortOpen Then
       MSComm1.Output = outslider
       End If
       Text1.Text = outslider$
cmdhome.Enabled = True
cmdleft.Enabled = True
cmdright.Enabled = True
cmdexit.Enabled = True
End Sub

Private Sub cmdleft_Click()
outslider$ = "!99PMV010   00300001@@" & Chr$(13) & Chr$(10)

If MSComm1.PortOpen Then
       MSComm1.Output = outslider$
        End If
    Text1.Text = outslider$
End Sub



Private Sub Form_Load()
cmdhome.Enabled = True
cmdleft.Enabled = False
cmdright.Enabled = False
cmdexit.Enabled = True

  MSComm1.CommPort = 1                 'Set COM1
  MSComm1.Settings = "9600,N,8,1"      ' Settings: 9600 baud, no parity, 8 data bits, 1 stop bit
  MSComm1.PortOpen = True              ' Open the port with the settings above
 
End Sub

Private Sub Form_Unload(Cancel As Integer)
 MSComm1.PortOpen = False             ' Close the port (let other programs use it)
End Sub
Avatar of AmericanDogma
AmericanDogma
Flag of United States of America image

for the text box use.

Private Sub txtBoxName_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    txtBoxName.Text = Val(txtBoxName.Text + 1)
End Sub


Where txtBoxName is the name of the textbox.  Also be sure to set the text property to whatever your desired starting integer is.
ASKER CERTIFIED SOLUTION
Avatar of Pickle
Pickle

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial