Public Class Form1
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("R01")
        ComboBox1.Items.Add("R02")
        ComboBox1.Items.Add("R03")
        ComboBox1.Items.Add("R04")
    End Sub
  
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        TextBox3.Focus()
        If ComboBox1.Text = "R01" Then
            TextBox1.Text = "Rokok Marlboro"
            TextBox2.Text = "9000"
        ElseIf ComboBox1.Text = "R02" Then
            TextBox1.Text = "Rokok Marcopolo"
            TextBox2.Text = "9000"
        ElseIf ComboBox1.Text = "R03" Then
            TextBox1.Text = "Rokok Sampoerna"
            TextBox2.Text = "10000"
        ElseIf ComboBox1.Text = "R04" Then
            TextBox1.Text = "Rokok Clubmild"
            TextBox2.Text = "7000"
        End If
    End Sub
    Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox7.Focus()
            TextBox4.Text = Val(TextBox2.Text) * Val(TextBox3.Text)
            If TextBox3.Text >= 5 And TextBox3.Text <= 10 Then
                TextBox5.Text = Val(TextBox4.Text) * 0.05
                TextBox6.Text = Val(TextBox4.Text) - Val(TextBox5.Text)
            ElseIf TextBox3.Text >= 11 Then
                TextBox5.Text = Val(TextBox4.Text) * 0.1
                TextBox6.Text = Val(TextBox4.Text) - Val(TextBox5.Text)
            ElseIf TextBox3.Text <= 4 Then
                TextBox5.Text = 0
                TextBox6.Text = Val(TextBox4.Text) - Val(TextBox5.Text)
            End If
        End If
    End Sub
    
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Clear()
        TextBox2.Clear()
        TextBox3.Clear()
        TextBox4.Clear()
        TextBox5.Clear()
        TextBox6.Clear()
        TextBox7.Clear()
        TextBox8.Clear()
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close()
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    End Sub
    Private Sub TextBox7_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox7.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox8.Text = Val(TextBox7.Text) - Val(TextBox6.Text)
        End If
    End Sub
    Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
    End Sub
End Class
Selasa, 05 Mei 2009
Quis Visual Basic
Diposting oleh pas-Fralis di 23.55
Langganan:
Posting Komentar (Atom)
 
 
 
 
 
 
0 komentar:
Posting Komentar