You are on page 1of 4

Nama : Asep Anwar Sanusi

NPM : 19402111

Kelas : SI-XW41/19

Quis Pertemuan 4
1. Pertama buka aplikasi Buka aplikasi Visual Studio

2. Lalu buat desain seperti dibawah ini

3. Properties
Label1 lb_nama
Label2 lb_jual
Label3 lb_beli
Label4 lb_laba
Label5 Banner
Label6 Banner
Label7 Banner
Textbox1 txt_npm
Textbox2 txt_nama
Textbox3 txt_jurusan
ComboBox cb_barang
Button1 btn_del
Button2 btn_exit

4. Koding

Public Class Form1

Private Sub Btn_del_Click(sender As Object, e As EventArgs) Handles Btn_del.Click


cb_barang.Text = ""
txt_beli.Text = ""
txt_jual.Text = ""
txt_laba.Text = ""
End Sub

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


cb_barang.Items.Clear()
cb_barang.Items.Add("Terigu")
cb_barang.Items.Add("Beras")
cb_barang.Items.Add("Mi Instan")
cb_barang.Items.Add("Rokok")
cb_barang.Items.Add("Susu")
End Sub

Private Sub Btn_exit_Click(sender As Object, e As EventArgs) Handles Btn_exit.Click


Btn_exit.Text = MsgBox("Anda Ingin Keluar Aplikasi ?", vbQuestion + vbOKCancel,
"Info")
If Btn_exit.Text = vbOK Then
End
End If
End Sub

Private Sub cb_barang_SelectedIndexChanged(sender As Object, e As EventArgs) Handles


cb_barang.SelectedIndexChanged
If cb_barang.SelectedIndex = 0 Then
txt_beli.Text = 10000
txt_jual.Text = Val(txt_beli.Text) + Val(txt_beli.Text * 0.05)
txt_laba.Text = Val(txt_jual.Text) - Val(txt_beli.Text)
ElseIf cb_barang.SelectedIndex = 1 Then
txt_beli.Text = 50000
txt_jual.Text = Val(txt_beli.Text) + Val(txt_beli.Text * 0.1)
txt_laba.Text = Val(txt_jual.Text) - Val(txt_beli.Text)
ElseIf cb_barang.SelectedIndex = 2 Then
txt_beli.Text = 5000
txt_jual.Text = Val(txt_beli) + Val(txt_beli.Text * 0.5)
txt_laba.Text = Val(txt_jual.Text) - Val(txt_beli.Text)
ElseIf cb_barang.SelectedIndex = 3 Then
txt_beli.Text = 25000
txt_jual.Text = Val(txt_beli) + Val(txt_beli.Text * 0.5)
txt_laba.Text = Val(txt_jual.Text) - Val(txt_beli.Text)
ElseIf cb_barang.SelectedIndex = 4 Then
txt_beli.Text = 50000
txt_jual.Text = Val(txt_beli) + Val(txt_beli.Text * 0.05)
txt_laba.Text = Val(txt_jual.Text) - Val(txt_beli.Text)
Else
MsgBox("Gak Ada Pilihan")
End If
End Sub
End Class

5. Tampilan Hasil

You might also like