View Single Post
Old 11-06-2008, 05:19 PM   #2
cuong86vt
Đệ tử 1 túi
 
Tham gia ngày: Jul 2007
Bài gửi: 22
:
code VB:

Code:
Dim dulieu As String
Dim a, b As Integer

Private Sub Command1_Click()
End
End Sub

Private Sub Form_Load()
MSComm1.PortOpen = True
''MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,8,1"
End Sub

Private Sub Option1_Click()
If (Option1.Value = True) And (Option2.Value = False) Then
    a = 1
ElseIf (Option1.Value = False) And (Option2.Value = True) Then
    a = 2
End If
End Sub

Private Sub Option2_Click()
If (Option1.Value = True) And (Option2.Value = False) Then
    a = 1
ElseIf (Option1.Value = False) And (Option2.Value = True) Then
    a = 2
End If
End Sub

Private Sub Text1_Change()
MSComm1.Output = Right(Text1.Text, 1)
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then       ''left
    MSComm1.Output = "l"
ElseIf KeyCode = 38 Then   ''up
    MSComm1.Output = "u"
ElseIf KeyCode = 39 Then   ''right
    MSComm1.Output = "r"
ElseIf KeyCode = 40 Then   ''down
    MSComm1.Output = "d"
ElseIf KeyCode = 13 Then   ''enter
    MSComm1.Output = "`"

End If
End Sub

thay đổi nội dung bởi: ngohaibac, 11-06-2008 lúc 07:01 PM.
cuong86vt vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn