KeyUp Event

14 May

From:    “Sofyan Efendi” <sofyan@madinah.cc>
Date:    Tue, 22 Aug 2006 11:16:21 +0700

Event KeyUp terjadi ketika tombol keyboard yang ditekan tersebut dilepas kembali keatas. Syntax:

Private Sub object_KeyUp( KeyCode As Integer, Shift As Integer)

Penjelasan:

– Object: Nama Form atau control di dalam Form.

– KeyCode: Kode tombol, misalnya vbKeyF1 berarti tombol F1 atau vbKeyHome berarti tombol HOME key). Untuk menjaga suatu form atau control dari penekanan suatu tombol, dapat mensetting KeyCode ke 0.

– Shift: Yakni penekanan tombol SHIFT, CTRL, dan ALT saat event ini dilakukan. Isilah dengan constants sbb:

. acShiftMask -> The bit mask for the SHIFT key.
. acCtrlMask -> The bit mask for the CTRL key.
. acAltMask -> The bit mask for the ALT key.

Contoh:

Private Sub KeyHandler_KeyUp( KeyCode As Integer, _
Shift As Integer)
Dim intShiftUp As Integer, intAltUp As Integer
Dim intCtrlUp As Integer

‘ Use bit masks to determine which key was pressed.
intShiftUp = (Shift And acShiftMask) > 0
intAltUp = (Shift And acAltMask) > 0
intCtrlUp = (Shift And acCtrlMask) > 0
‘ Display message telling user which key was pressed.
If intShiftUp Then MsgBox “You pressed the SHIFT key.”
If intAltUp Then MsgBox “You pressed the ALT key.”
If intCtrlUp Then MsgBox “You pressed the CTRL key.”
End Sub

Wassalaamu’alaikum Warahmatullahi Wabarakatuh,
Sofyan Efendi
– AccessWeb <http://www35.websamba.com/accessweb&gt;
– OPI-Homepage <http://www.geocities.com/opi1978&gt;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: