Berikut ini adalah cara memeriksa tombol keyboard saat event KeyDown, KeyPress dan KeyUp di Form di visual basic 6, untuk mempraktekannya siapkan :
1. Buat 1 Project baru dengan 1 Form.2. Copy-kan coding berikut ke editor form yang bertalian.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim msg As String
frmForm1.Cls
frmForm1.CurrentX = 100
frmForm1.CurrentY = 100
msg = "Mendapat event KeyDown. KeyCode = " & KeyCode
msg = msg & " Shift = " & Shift
frmForm1.Print msg
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim msg As String
frmForm1.CurrentX = 100
frmForm1.CurrentY = 500
msg = "Mendapat event KeyPress. KeyAscii = " & KeyAscii
frmForm1.Print msg
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim msg As String
frmForm1.CurrentX = 100
frmForm1.CurrentY = 900
msg = "Mendapat event KeyUp. KeyCode = " & KeyCode
msg = msg & " Shift = " & Shift
frmForm1.Print msg
End Sub
Private Sub Form_Load()
frmForm1.FontTransparent = False
End Sub
Tags:
contoh program vb6, contoh fungsi di vb6, cara penggunaan fungsi vb, tutorial vb6, download tutorial vb6, vb6 tutorial download, dasar dasar vb6, belajar vb6, cara mudah belajar vb6, vb6 artikel download, vb6 blog, contoh program vb6, artikel vb6, semua tentang vb6, vb6 api, cara menggunakan module, cara menggunakan class module
0 komentar:
Posting Komentar