Sei sulla pagina 1di 7

CODING :

 Double klik sembarang di form/form load

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

DTTanggal.Format = DateTimePickerFormat.Custom

DTTanggal.CustomFormat = "d/M/y"

DTTanggal.Value = Format(Now)

ListBox1.Items.Add("L")

ListBox1.Items.Add("G")

ListBox1.Items.Add("M")

End Sub

 COMBOBOX(Double klik)

Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles


ComboBox1.SelectedIndexChanged

If ListBox1.Text = "L" And ComboBox1.Text = "Ekonomi" Then

TextBox1.Text = "Lion Air"

TextBox2.Text = "1000000"

ElseIf ListBox1.Text = "L" And ComboBox1.Text = "Bisnis" Then

TextBox1.Text = "Lion Air"

1
TextBox2.Text = "2000000"

ElseIf ListBox1.Text = "L" And ComboBox1.Text = "VIP" Then

TextBox1.Text = "Lion Air"

TextBox2.Text = "3000000"

ElseIf ListBox1.Text = "G" And ComboBox1.Text = "Ekonomi" Then

TextBox1.Text = "Garuda Indonesia"

TextBox2.Text = "2000000"

ElseIf ListBox1.Text = "G" And ComboBox1.Text = "Bisnis" Then

TextBox1.Text = "Garuda Indonesia"

TextBox2.Text = "3000000"

ElseIf ListBox1.Text = "G" And ComboBox1.Text = "VIP" Then

TextBox1.Text = "Garuda Indonesia"

TextBox2.Text = "4000000"

ElseIf ListBox1.Text = "M" And ComboBox1.Text = "Ekonomi" Then

TextBox1.Text = "Mandala Airlines"

TextBox2.Text = "1500000"

ElseIf ListBox1.Text = "M" And ComboBox1.Text = "Bisnis" Then

TextBox1.Text = "Mandala Airlines"

TextBox2.Text = "2500000"

ElseIf ListBox1.Text = "M" And ComboBox1.Text = "VIP" Then

TextBox1.Text = "Mandala Airlines"

TextBox2.Text = "3500000"

End If

End Sub

 LISTBOX1(double klik)

Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles


ListBox1.SelectedIndexChanged

If ListBox1.Text = "L" Then

ComboBox1.Items.Clear()

ComboBox1.Items.Add("Ekonomi")

2
ComboBox1.Items.Add("Bisnis")

ComboBox1.Items.Add("VIP")

ElseIf ListBox1.Text = "G" Then

ComboBox1.Items.Clear()

ComboBox1.Items.Add("Ekonomi")

ComboBox1.Items.Add("Bisnis")

ComboBox1.Items.Add("VIP")

ElseIf ListBox1.Text = "M" Then

ComboBox1.Items.Clear()

ComboBox1.Items.Add("Ekonomi")

ComboBox1.Items.Add("Bisnis")

ComboBox1.Items.Add("VIP")

End If

End Sub

 BUTTON 2/Lagi(double klik)

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click

TextBox1.Clear()

TextBox2.Clear()

TextBox3.Clear()

TextBox5.Text = ""

TextBox6.Clear()

End Sub

 BUTTON 3/keluar(Double klik)

Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click

Dim x As String

x = MsgBox("Yakin akan Keluar?", vbCritical + vbYesNo, "KONFIRMASI")

If x = vbYes Then

Me.Close()

End If

End Sub

3
 Button 1/hitung(double klik)

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

TextBox3.Text = Val(NumericUpDown1.Value) * Val(TextBox2.Text)

End Sub

 Buat sendiri(manual) di bawah public class

Private Sub TextBox6_enter()

If Val(TextBox6.Text) < Val(TextBox3.Text) Then

MsgBox("Uang Bayar Anda Kurang!")

Else

TextBox5.Text = Val(TextBox6.Text) - Val(TextBox3.Text)

End If

End Sub

 BAGIAN KEYPRESS TEXTBOX6(properties>event>keypress)

Private Sub TextBox6_KeyPress(sender As System.Object, e As


System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress

If e.KeyChar = Chr(13) Then

Call TextBox6_enter()

End If

End Sub

End Class

-----------------------------SELESAI--------------------------

4
KISI 2:

Coding:

 BUTTON3/KELUAR

Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click

Dim x As String

x = MsgBox("APAKAH INGIN KELUAR?", vbCritical + vbYesNo, "KELUAR")

If x = vbYes Then

Me.Close()

End If

End Sub

5
 DOUBLE KLIK SEMBARANG(FORM LOAD)

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

ListBox1.Items.Add("MANAJER")

ListBox1.Items.Add("KABAG")

ListBox1.Items.Add("STAFF")

ComboBox1.Items.Add("A")

ComboBox1.Items.Add("B")

End Sub

 DOUBLE KLIK LISTBOX1

Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles


ListBox1.SelectedIndexChanged

If ListBox1.SelectedIndex = 0 Then

gaji.Text = 1500000

ElseIf ListBox1.SelectedIndex = 1 Then

gaji.Text = 1000000

ElseIf ListBox1.SelectedIndex = 2 Then

gaji.Text = 750000

End If

End Sub

 DOUBLE KLIK COMBOBOX1

Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles


ComboBox1.SelectedIndexChanged

If ComboBox1.SelectedIndex = 0 Then

tj.Text = 250000

ElseIf ComboBox1.SelectedIndex = 1 Then

tj.Text = 100000

End If

End Sub

6
 DOUBLE KLIK BUTTON 1/HITUNG

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

gk.Text = Val(gaji.Text) + Val(tj.Text)

p.Text = 0.05 * Val(gk.Text)

tot.Text = Val(gk.Text) – Val(p.Text)

End Sub

 DOUBLE KLIK BUTTON 2/HAPUS

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click

gaji.Text = ""

p.Text = ""

gk.Text = ""

tot.Text = ""

TextBox1.Text = ""

tj.Text = ""

ComboBox1.ResetText()

ListBox1.Refresh()

End Sub

 DOUBLE KLIK PADA KEYPRESS TEXTBOX 1(Properties>event>keypress)

Private Sub TextBox1_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs)


Handles TextBox1.KeyPress

If Char.IsNumber(e.KeyChar) Then

e.Handled = True

End If

End Sub

End Class

---------SELESAI-------
7

Potrebbero piacerti anche