Artikel
-21
Contoh
Program Pencabangan If
Public Class Form1
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
tipe.Items.Add("nokia")
tipe.Items.Add("samsung")
tipe.Items.Add("siemen")
tipe.Items.Add("motorola")
End Sub
Private Sub tipe_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
tipe.SelectedIndexChanged
seri.Items.Clear()
If
tipe.Text = "nokia" Then
seri.Items.Add("n70")
seri.Items.Add("n73")
End If
If
tipe.Text = "samsung" Then
seri.Items.Add("sIII")
seri.Items.Add("gyoung")
End If
If
tipe.Text = "siemen" Then
seri.Items.Add("C555")
seri.Items.Add("C44")
End If
If
tipe.Text = "motorola" Then
seri.Items.Add("mx3I")
seri.Items.Add("xm3I")
End If
End Sub
Private Sub seri_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
seri.SelectedIndexChanged
kondisi.Items.Clear()
If
seri.Text = "n70" Then
kondisi.Items.Add("baru")
kondisi.Items.Add("second")
ElseIf
seri.Text = "n73" Then
kondisi.Items.Add("baru")
kondisi.Items.Add("second")
End If
If
seri.Text = "sIII" Then
kondisi.Items.Add("baru")
kondisi.Items.Add("second")
ElseIf
seri.Text = "gyoung" Then
kondisi.Items.Add("baru")
kondisi.Items.Add("second")
End If
If
seri.Text = "C555" Then
kondisi.Items.Add("baru")
kondisi.Items.Add("second")
ElseIf
seri.Text = "C44" Then
kondisi.Items.Add("baru")
kondisi.Items.Add("second")
End If
If
seri.Text = "mx3I" Then
kondisi.Items.Add("baru")
kondisi.Items.Add("second")
ElseIf
seri.Text = "xm3I" Then
kondisi.Items.Add("baru")
kondisi.Items.Add("second")
End If
End Sub
Private Sub kondisi_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
kondisi.SelectedIndexChanged
If
seri.Text = "n70" And kondisi.Text = "baru"
Then
harga.Text = 3000000
ElseIf
seri.Text = "n70" And kondisi.Text = "second"
Then
harga.Text = 2500000
ElseIf
seri.Text = "n73" And kondisi.Text = "baru"
Then
harga.Text = 3000000
ElseIf
seri.Text = "n73" And kondisi.Text = "second"
Then
harga.Text = 2500000
End If
If
seri.Text = "sIII" And kondisi.Text = "baru"
Then
harga.Text = 2000000
ElseIf seri.Text
= "sIII" And
kondisi.Text = "second" Then
harga.Text = 1500000
ElseIf
seri.Text = "gyoung" And kondisi.Text = "baru"
Then
harga.Text = 2000000
ElseIf
seri.Text = "gyoung" And kondisi.Text = "second"
Then
harga.Text = 1500000
End If
If
seri.Text = "C555" And kondisi.Text = "baru"
Then
harga.Text = 3500000
ElseIf
seri.Text = "C555" And kondisi.Text = "second"
Then
harga.Text = 1500000
ElseIf
seri.Text = "C44" And kondisi.Text = "baru"
Then
harga.Text = 3750000
ElseIf
seri.Text = "C44" And kondisi.Text = "second"
Then
harga.Text = 1570000
End If
If
seri.Text = "mx3I" And kondisi.Text = "baru"
Then
harga.Text = 2500000
ElseIf
seri.Text = "mx3I" And kondisi.Text = "second"
Then
harga.Text = 1340000
ElseIf
seri.Text = "xm3I" And kondisi.Text = "baru"
Then
harga.Text = 2750000
ElseIf
seri.Text = "xm3I" And kondisi.Text = "second"
Then
harga.Text = 1450000
End If
End Sub
End Class
Tidak ada komentar:
Posting Komentar