Kasus 1 (Tipe Data dan Variabel)
Berikut
Source Codenya :
Public
Class kasus1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim nik, nama, jabatan, alamat As String
nik = TextBox1.Text
nama = TextBox2.Text
jabatan = ComboBox1.Text
alamat = TextBox3.Text
'nadiahtami 2017230007'
TextBox4.Text = nik
TextBox5.Text = nama
TextBox6.Text = jabatan
TextBox7.Text = alamat
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not ((e.KeyChar >= "0" And e.KeyChar <=
"9") Or e.KeyChar = vbBack) Then e.Handled = True 'hanya bisa
menginput angka
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
ComboBox1.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim pesan As String
pesan = MsgBox("Yakin Ingin Keluar ??", vbYesNo,
"Konfirmasi")
If pesan = vbYes Then
Close()
End
End If
End Sub
End Class
Kasus 2 (Tipe Data dan Variabel)
Berikut
Source Codenya :
Public
Class kasus2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim kode, nama, isbn, kategori, harga As String
kode = TextBox1.Text
nama = TextBox2.Text
isbn = TextBox3.Text
kategori = ComboBox1.Text
harga = TextBox4.Text
'nadiahtami 201723007'
TextBox5.Text = kode
TextBox6.Text = nama
TextBox7.Text = isbn
TextBox8.Text = kategori
TextBox9.Text = harga
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not ((e.KeyChar >= "0" And e.KeyChar <=
"9") Or e.KeyChar = vbBack) Then e.Handled = True 'hanya bisa
menginput angka
If (e.KeyChar = Chr(13)) Then
TextBox2.Focus()
End If
End Sub
Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
If Not ((e.KeyChar >= "0" And e.KeyChar <=
"9") Or e.KeyChar = vbBack) Then e.Handled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
ComboBox1.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim pesan As String
pesan = MsgBox("Yakin Ingin Keluar ??", vbYesNo,
"Konfirmasi")
If pesan = vbYes Then
Close()
End
End If
End Sub
End Class
Kasus 3 (Tipe Data dan Variabel)
Berikut Source Codenya :
Public Class kasus3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nim, nama, jk, jurusan, alamat As String
nim = TextBox1.Text
nama = TextBox2.Text
jk = ComboBox1.Text
jurusan = ComboBox2.Text
alamat = TextBox3.Text
'nadiahtami 201723007'
TextBox4.Text = nim
TextBox5.Text = nama
TextBox6.Text = jk
TextBox7.Text = jurusan
TextBox8.Text = alamat
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not ((e.KeyChar >= "0" And e.KeyChar <= "9") Or e.KeyChar = vbBack) Then e.Handled = True 'hanya bisa menginput angka
If (e.KeyChar = Chr(13)) Then
TextBox2.Focus()
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim pesan As String
pesan = MsgBox("Yakin Ingin Keluar ??", vbYesNo, "Konfirmasi")
If pesan = vbYes Then
Close()
End
End If
End Sub
End Class
Komentar
Posting Komentar