Berikut program pemakaian IF Jamak 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
If
NIK.Text = "K1-001" Then
Nama.Text = "Aldyan"
ElseIf
NIK.Text = "K1-002" Then
Nama.Text = "Triarista"
ElseIf
NIK.Text = "K2-003" Then
Nama.Text = "Chairunisa"
ElseIf
NIK.Text = "K3-004" Then
Nama.Text = "Surya Darma"
ElseIf
NIK.Text = "K3-005" Then
Nama.Text = "Susanti"
Else
Nama.Text = "-"
End If
End Sub
Private Sub Jabatan_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Jabatan.SelectedIndexChanged
If
Jabatan.Text = "-" Then
Gaji.Text = 1250000
ElseIf
Jabatan.Text = "Manager" Then
Gaji.Text = 4250000
ElseIf
Jabatan.Text = "Supervisor" Then
Gaji.Text = 3250000
ElseIf
Jabatan.Text = "Mandor" Then
Gaji.Text = 2250000
End If
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.
0 comments:
Post a Comment
Terima kasih apabila sudah memberikan komentar yang baik dan sopan :)