KeyPress Event

14 May

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

Event KeyPress terjadi saat user menekan tombol pada keyboard dan menahannya sesaat atau sebelum tombol tersebut dilepas kembali keatas. Syntax:

Private Sub object_KeyPress( KeyAscii As Integer)

Penjelasan:

– Object: Nama Form atau control di dalam Form.

– KeyAscii: Yakni setting kode Ascii yang dihasilkan. Menset KeyAscee ke dalam 0 akan menyebabkan event ini di cancel, sehingga user tidak akan melihat hasil ketikkannya pada control.

Contoh:

Private Sub ShipRegion_KeyPress (KeyAscii As Integer)
Dim strCharacter As String

‘ Convert ANSI value to character string.
strCharacter = Chr(KeyAscii)
‘ Convert character to upper case, then to ANSI value.
KeyAscii = Asc(UCase(strCharac ter))
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: