Windows

Hosting Unlimited Indonesia

MEMBUAT TEXTBOX HANYA BISA DI ISI ANGKA SAJA DENGAN VB 6.0






OBJEK
PROPERTIES
VALUE
FORM
name
frmhobby

Caption
Data Hobby

BorderStyle
2-sizable

StartUpPosition
centerscreen
Label1
name
Label1

caption
NIM
Label2
Name
Label2

Caption
NAMA
Label3
Name
Label3

Caption
OUTPUT
Frame1
name
Frame1

Caption
Jenis Kelamin
Frame2
name
Frame2

Caption
Hobby
Option1
Name
optlaki

Caption
Laki-Laki
Option2
Name
optperempuan

Caption
Perempuan
Checkbox1
Name
chkrenang

Caption
Berenang
Checkbox2
Name
chktidur

caption
Tidur
Checkbox3
name
chkMakan

caption
Makan
Checkbox4
Name
chkMusic

Caption
Dengar Music
Textbox1
name
txtnama
textBox2
name
txtnim
Textbox3
Name
txthasil
Command1
Name
cmdproses

Caption
&PROSES
Command2
Name
cmdkeluar

Caption
&KELUAR

KODE PROGRAM :
Private Sub cmdKeluar_Click()
End
End Sub

Private Sub cmdProses_Click()
Dim jk, hobby As String
If optLaki.Value = True Then
   jk = "Laki-Laki"
Else
   jk = "Perempuan"
End If
If chkrenang.Value = 1 Then
   hobby = "Berenang"
   chkrenang.Enabled = True
Else
   chkrenang.Enabled = False

End If
If chktidur.Value = 1 Then
   hobby = hobby & "Tidur"
   chktidur.Enabled = True
Else
   chktidur.Enabled = False
End If

If chkmakan.Value = 1 Then
   hobby = hobby & "Makan"
   chkmakan.Enabled = True
Else
   chkmakan.Enabled = False
End If

If chkmusic.Value = 1 Then
   hobby = hobby & "Mendengar Music"
   chkmusic.Enabled = True
Else
   chkmusic.Enabled = False
End If

txtHasil.Text = "Nim : " & txtnim.Text & vbNewLine & _
"Nama : " & txtNama.Text & vbNewLine & _
"Jenis Kelamin : " & jk & vbNewLine & "Hobby : " & hobby
End Sub

Private Sub txtNim_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
   txtNama.SetFocus
End If
If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeySpace Or KeyAscii = vbKeyReturn) Then
MsgBox "Maaf Hanya Boleh Diisi Angka Saja", vbInformation + vbOKOnly, "Perhatian"
KeyAscii = 0
End If
End Sub

Untuk teman2 yang ingin sewa hosting atau beli domain bisa disini iya : Link
dan gunakan Kode Kupon Berikut : YBNBLOG20 untuk mendapatkan potongan 5%

*KEJUJURAN ADALAH KEBIJAKSANAAN YANG PALING BAIK *

Post a Comment

2 Comments