Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged Dim x As String x = Microsoft.VisualBasic.Left(Kode.Text, 2) Select Case x Case "TS" : Nama.Text = "Toshiba" Case "LG" : Nama.Text = "LG" Case "PL" : Nama.Text = "Polytron" Case "SN" : Nama.Text = "Sony" End Select Dim y As String y = Microsoft.VisualBasic.Mid(Kode.Text, 1) Select Case y Case "TS001" : Harga.Text = "950000" Case "LG002" : Harga.Text = "876000" Case "PL001" : Harga.Text = "990000" Case "SN002" : Harga.Text = "957000" End Select End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Kode.Items.Add("TS001") Kode.Items.Add("LG002") Kode.Items.Add("PL001") Kode.Items.Add("SN002") End Sub
Private Sub Proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Proses.Click TotalHarga.Text = Val(Harga.Text) * Val(Jumlah.Text) If TotalHarga.Text >= 2500000 Then Discount.Text = 0.1 * TotalHarga.Text ElseIf TotalHarga.Text <= 2500000 Then Discount.Text = 0 End If
TotalBayar.Text = Val(TotalHarga.Text) - Val(Discount.Text) End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click Kode.Text = "" Nama.Text = "" Harga.Text = "" Jumlah.Text = "" TotalHarga.Text = "" Discount.Text = "" TotalBayar.Text = "" End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click End End Sub