quat 2 form
---kết nối 2 form: quạt
Private Sub cmd_port_Click()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
Else
MSComm1.PortOpen = True
MsgBox "Port is now opened", vbOKOnly, "Welcome"
End If
Form6.Show
End Sub
Private Sub cmd_thuan_Click()
If MSComm1.PortOpen = True Then
MSComm1.Output = "a"
Else
MsgBox "Port isn't opened", vbCritical, "Error"
End If
End Sub
Private Sub cmd_nguoc_Click()
If MSComm1.PortOpen = True Then
MSComm1.Output = "b"
Else
MsgBox "Port isn't opened", vbCritical, "Error"
End If
End Sub
Private Sub MSComm2_OnComm()
Dim kt As Variant
kt = MSComm2.Input
If kt = "a" Then
Timer1.Enabled = True
Timer2.Enabled = False
End If
If kt = "b" Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
If kt = "c" Then
Timer1.Enabled = False
Timer2.Enabled = False
End If
End Sub
Private Sub Timer1_Timer()
d = d + 1
Image1.Picture = ImageList1.ListImages.Item(d).Picture
If d = 9 Then d = 0
End Sub
Private Sub Timer2_Timer()
If d <= 1 Then d = 9
d = d - 1
Image1.Picture = ImageList1.ListImages.Item(d).Picture
End Sub
Bạn đang đọc truyện trên: Truyen247.Pro