Jumat, 01 Mei 2015


houston mesothelioma lawyers mesothelioma attorneys los angeles malignant mesothelioma pleural rate survival delaware mesothelioma lawyers asbestos attorneys philadelphia missouri mesothelioma lawyers mesothelioma lawyers houston asbestos lawyers los angeles illinois mesothelioma lawyers houston mesothelioma attorney colorado mesothelioma lawyers mesothelioma attorneys san diego georgia mesothelioma lawyer asbestos law suits mesothelioma attorneys california california mesothelioma attorneys detroit personal injury attorney student loan consilidation fort worth dwi lawyer tennessee mesothelioma lawyer diffuse malignant pleural mesothelioma irs debt attorney applied foundation mesothelioma research dallas dwi lawyers oklahoma city personal injury attorney mesothelioma lawyers california hawaii car accident lawyer houston dwi attorney mesothelioma applied research foundation houston mesothelioma mesothelioma houston michigan personal injury lawyer ca car donations car donations ca california mesothelioma lawyers wrongful death attorney los angeles illinois mesothelioma attorney dui attorneys los angeles los angeles dui attorneys college student loan consolidation mesothelioma washington attorney washington mesothelioma attorney mesothelioma attorney ohio ohio mesothelioma attorney georgia mesothelioma lawyers colorado mesothelioma attorneys asbestos law firm oklahoma personal injury attorney colorado accident lawyers michigan personal injury attorney

Visual Basic: Membuat Inputan Hanya Angka Atau Huruf Saja

Dalam membuat program menggunakan visual basic atau vb 6, seperti halnya program nilai pastinya inputan dalam textbox tidak boleh berbentuk huruf. Apa jadinya kalau di inputan nilai yang harusnya angka kok diisi huruf? Bisa-bisa pengolahan nilainya akan jadi berantakan bahkan error. Nah untuk mengantisipasinya, saya akan memberikan caranya supaya inputan hanya berbentuk angka atau huruf saja. 

Silahkan jalankan dulu program visual basic di laptop/PC kalian. Nanti silahkan kalian desain form dengan 2 komponen Textbox. Satu untuk inputan huruf dan satunya lagi untuk inputan angka. Silahkan masukkan script berikut di dalam event Keypress:

Inputan Angka
If Not (KeyAscii >= Asc("0") & Chr(13) And KeyAscii <= Asc("9") & Chr(13) Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeySpace) Then
MsgBox "Hanya Angka Saja", 48, "STOP"
KeyAscii = 0
End If
Inputan Huruf
If Not (KeyAscii >= Asc("a") & Chr(13) And KeyAscii <= Asc("z") & Chr(13) Or (KeyAscii >= Asc("A") & Chr(13) And KeyAscii <= Asc("Z") & Chr(13) Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeySpace)) Then
MsgBox "Hanya Huruf Saja", 48, "STOP"
KeyAscii = 0
End If



Sript di atas sudah dilengkapi kotak pesan sebagai validasi. Semoga bermanfaat.

1 comments so far

terimakasih gan, sangat bermanfaat


EmoticonEmoticon