Berikut program pemakaian select case menggunakan Visual Basic Net.
Public Class Form1
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
NIK.Items.Add("K1-001")
NIK.Items.Add("K1-002")
NIK.Items.Add("K2-003")
NIK.Items.Add("K3-004")
NIK.Items.Add("K3-005")
Jabatan.Items.Add("-")
Jabatan.Items.Add("Manager")
Jabatan.Items.Add("Supervisor")
Jabatan.Items.Add("Mandor")
End Sub
Private Sub NIK_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles NIK.SelectedIndexChanged
Select Case NIK.Text
Case
"K1-001"
Nama.Text = "Aldyan"
Case
"K1-002"
Nama.Text = "Triarista"
Case
"K2-003"
Nama.Text = "Chairunisa"
Case
"K3-004"
Nama.Text = "Surya Darma"
Case
"K3-005"
Nama.Text = "Susanti"
Case
Else
Nama.Text = "-"
End Select
End Sub
Private Sub Jabatan_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Jabatan.SelectedIndexChanged
Select
Jabatan.Text
Case
"-"
Gaji.Text = 1250000
Case
"Manager"
Gaji.Text = 4250000
Case
"Supervisor"
Gaji.Text = 3250000
Case
"Mandor"
Gaji.Text = 2250000
Case
Else
Gaji.Text = 0
End Select
End Sub
Private Sub btnKeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnKeluar.Click
End
End Sub
Private Sub btnHapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnHapus.Click
NIK.Text = ""
Nama.Text = ""
Jabatan.Text = ""
Gaji.Text = ""
NIK.Focus()
End Sub
End Class
Semoga program ini bermanfaat.
Nama: Andreas
ReplyDeleteKelas: TI-M1211
NPM:12110032
andreas.blogspot.com/2013/10/pemakaian-select-case-pada-visual-basic.html