Contoh program Kelas dan Jurusan
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox1.Focus()
End Sub
Button2
End Sub
Klik 2x pada Textbox1 pada bagian pojok kanan pilih combo declaration sehingga bernilai " Keypress "
If e.KeyChar = Chr(13) Then ' jika enter di pilih/ditekan'
If TextBox1.Text = "" Then
MsgBox("Nama harus diisi")
TextBox1.Focus()
Exit Sub
Else
TextBox2.Focus()
End If
End If
End Sub
Sama halnya dengan Textbox1, ikuti langkah untuk textbox2 :
If e.KeyChar = Chr(13) Then ' jika enter di pilih/ditekan'
If TextBox2.Text = "" Then
MsgBox("Kelas harus diisi")
TextBox2.Focus()
Exit Sub
Else
TextBox2.Focus()
End If
End If
End If
End Sub
End Class
Slamat Mencoba,...mau unduh silahkan
tool /objek yg digunakan :
   1. Textbox 3 buah
   2. Button 2 buah
Coding pada :
Button 1TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox1.Focus()
End Sub
me.close()
EndEnd Sub
If e.KeyChar = Chr(13) Then ' jika enter di pilih/ditekan'
If TextBox1.Text = "" Then
MsgBox("Nama harus diisi")
TextBox1.Focus()
Exit Sub
Else
TextBox2.Focus()
End If
End If
End Sub
If e.KeyChar = Chr(13) Then ' jika enter di pilih/ditekan'
If TextBox2.Text = "" Then
MsgBox("Kelas harus diisi")
TextBox2.Focus()
Exit Sub
Else
    If TextBox2.Text <> "MI" And TextBox2.Text <> "MA" And  TextBox2.Text <> "SK"  
    And TextBox2.Text <> "AK" Then
       MsgBox("Kelas tidak terdaftar")TextBox2.Focus()
    Else
    If TextBox2.Text = "MI" Then         TextBox3.Text = "Manajemen Informatika"
    If TextBox2.Text = "MA" Then         TextBox3.Text ="Manajemen Adminsitrasi"
    If TextBox2.Text = "SK" Then         TextBox3.Text = "Sekretari"
    If TextBox2.Text = "AK" Then         TextBox3.Text = "Akuntansi"
         Button1.Focus()End If
End If
End If
End Sub
End Class
 
  
No comments:
Post a Comment