Contoh
case
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Jenis.Items.Add("LAPTOP")
Jenis.Items.Add("HANDPHONE")
End Sub
Private Sub Jenis_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Jenis.SelectedIndexChanged
merek.Items.Clear()
Select Case Jenis.Text
Case "LAPTOP"
merek.Items.Add("acer")
merek.Items.Add("toshiba")
merek.Items.Add("axio")
merek.Items.Add("suzuki")
merek.Items.Add("vaio")
End Select
Select Case Jenis.Text
Case "HANDPHONE"
merek.Items.Add("nokia")
merek.Items.Add("nexian")
merek.Items.Add("esia")
merek.Items.Add("sony")
End Select
End Sub
Private Sub merek_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles merek.SelectedIndexChanged
Select Case merek.Text
Case "acer"
harga.Text = 4500000
Case "toshiba"
harga.Text = 6000000
Case "axio"
harga.Text = 5000000
End Select
Select Case merek.Text
Case "nokia"
harga.Text = 2000000
Case "nexian"
harga.Text = 1000000
Case "esia"
harga.Text = 500000
End Select
End
Sub
Private Sub j_beli_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles j_beli.KeyPress
If Asc(e.KeyChar) = 13 Then
If j_beli.Text> 10 Then
diskon.Text = 0.1 * harga.Text
Else
diskon.Text = 0
End If
Total_B.Text = harga.Text * j_beli.Text -
diskon.Text
End If
End Sub
Private Sub BAYAR_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles BAYAR.KeyPress
If Asc(e.KeyChar) = 13 Then
kembali.Text = BAYAR.Text - Total_B.Text
End If
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnkeluar.Click
End
End Sub
End Class
Tidak ada komentar:
Posting Komentar