PIC Vietnam

PIC Vietnam (http://www.picvietnam.com/forum/index.php)
-   Các ngôn ngữ lập trình khác (CCS C, HT PIC,...) (http://www.picvietnam.com/forum/forumdisplay.php?f=12)
-   -   giúp em về ngôn Visua Basic với các Anh,Chị ơi !!! (http://www.picvietnam.com/forum/showthread.php?t=10341)

loveofteens8x 28-07-2011 12:10 AM

giúp em về ngôn Visua Basic với các Anh,Chị ơi !!!
 
1 Attachment(s)
Có 1 đoạn code Visua Bassic ( vesion 6.0 ) như thế này, nhưng chỉ có vài câu lệnh là được giải thích ý nghĩa. Có Anh, Chị nào hiểu về ngôn ngữ này làm ơn giải thích giùm em ý nghĩa từng lệnh được không ạ, còn vài lệnh đã được giải thích rồi nều không hợp lý thì mong Anh, Chị bổ sung thêm luôn.. em thanks Anh, Chị nào giúp đỡ nhiều lắm !!!

Private Sub Command3_Click()
MSComm1.CommPort = Text1.Text ‘ so thu tu cong truyen thong
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False ‘ xac nhan mo cong
Else
MSComm1.Settings = " 2400 , n , 8 , 1" ‘xac dinh cac tham so truyen
MSComm1.RThreshold = 1
MSComm1.PortOpen = True
End If
Command3.Visible = False ‘an chu command3
Timer2.Enabled = True
End Sub

Private Sub Command4_Click()
If Text4.Text > 0 Then
Text4.Text = Text4.Text - 1
End If
End Sub

Private Sub Command5_Click()
If Text4.Text < 50 Then
Text4.Text = Text4.Text + 1
End If
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft 'Xu ly nut di chuyen trai tren ban phim
Label3.Caption = "Down"
If Text2.Text > 0 Then
Text2.Text = Text2.Text - 1
End If
Case vbKeyRight 'Xu ly nut di chuyen phai tren ban phim
Label3.Caption = "Up"
If Text2.Text < 9 Then
Text2.Text = Text2.Text + 1
End If
Case vbKeyUp 'Xu ly nut di chuyen tren tren ban phim
Label5.Caption = "Next"
If Text4.Text < 5 Then
Text4.Text = Text4.Text + 1
End If

Case vbKeyDown 'Xu ly nut di chuyen duoi tren ban phim
Label5.Caption = "Back"
If Text4.Text > 0 Then
Text4.Text = Text4.Text - 1
End If

Case vbKeyShift 'Xu ly nut shift tren ban phim
Label2.Caption = "Xoay"
Text5.Text = "1"
Case vbKeyControl 'Xu ly nut control tren ban phim
Label2.Caption = "Can bang"
Text5.Text = "0"
End Select
End Sub




Private Sub Timer1_Timer()
Text3.Text = 9 - Text2.Text

End Sub

Private Sub Timer2_Timer()
MSComm1.Output = "s" + Text3.Text ‘ ham xuat ki tu ra cong noi tiep
MSComm1.Output = "t" + Text4.Text
MSComm1.Output = "x" + Text5.Text

End Sub


Múi giờ GMT. Hiện tại là 09:01 PM.

Tên diễn đàn: vBulletin Version 3.8.11
Được sáng lập bởi Đoàn Hiệp.
Copyright © PIC Vietnam