0% found this document useful (0 votes)
23 views6 pages

Kuis Kaa

The document contains code for 6 different VB.NET programs. Program 1 changes the color of a panel when buttons are clicked. Program 2 performs basic math calculations on values from textboxes when buttons are clicked. Program 3 calculates student grades and outputs the grade, index and predicate when a button is clicked. Program 4 handles product selection from a dropdown, calculates subtotals and discounts, and outputs values to textboxes. Program 5 calculates ticket prices and amounts due based on selections, and outputs totals. Program 6 calculates utility bills based on selections, calculating component and total costs and outputting them to textboxes.

Uploaded by

silvi ega
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views6 pages

Kuis Kaa

The document contains code for 6 different VB.NET programs. Program 1 changes the color of a panel when buttons are clicked. Program 2 performs basic math calculations on values from textboxes when buttons are clicked. Program 3 calculates student grades and outputs the grade, index and predicate when a button is clicked. Program 4 handles product selection from a dropdown, calculates subtotals and discounts, and outputs values to textboxes. Program 5 calculates ticket prices and amounts due based on selections, and outputs totals. Program 6 calculates utility bills based on selections, calculating component and total costs and outputting them to textboxes.

Uploaded by

silvi ega
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

No.

1 :
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
Panel1.BackColor = Color.Red
End Sub

Private Sub Button2_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button2.Click
Panel1.BackColor = Color.Blue
End Sub

Private Sub Button3_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button3.Click
Panel1.BackColor = Color.Black
End Sub
End Class

No. 2 :
Public Class Form2
Dim bilangan1, bilangan2, hasil As Integer

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
bilangan1 = Val(TextBox1.Text)
bilangan2 = Val(TextBox2.Text)
hasil = bilangan1 + bilangan2
TextBox3.Text = Str(hasil)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button2.Click
bilangan1 = Val(TextBox1.Text)
bilangan2 = Val(TextBox2.Text)
hasil = bilangan1 - bilangan2
TextBox3.Text = Str(hasil)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button3.Click
bilangan1 = Val(TextBox1.Text)
bilangan2 = Val(TextBox2.Text)
hasil = bilangan1 / bilangan2
TextBox3.Text = Str(hasil)
End Sub

Private Sub Button4_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button4.Click
bilangan1 = Val(TextBox1.Text)
bilangan2 = Val(TextBox2.Text)
hasil = bilangan1 * bilangan2
TextBox3.Text = Str(hasil)
End Sub

Private Sub Button5_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox1.Select()

End Sub
End Class
No.3 :
Public Class Form1
Dim tugas, kuis, UTS, UAS, Nilaiakhir, predikat, index As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
tugas = Val(txtNT.Text)
kuis = Val(txtNQ.Text)
UTS = Val(txtNUT.Text)
UAS = Val(txtNUA.Text)
txtNA.Text = (Nilaiakhir)
Nilaiakhir = (0.1 * tugas + 0.2 * kuis + 0.3 * UTS + 0.4 *
UAS)

If Nilaiakhir >= 80 Then


index = "A"
predikat = "Sangat Baik"
ElseIf Nilaiakhir >= 68 Then
index = "B"
predikat = "Baik"
ElseIf Nilaiakhir >= 56 Then
index = "C"
predikat = "Cukup"
ElseIf Nilaiakhir >= 45 Then
index = "D"
predikat = "Kurang"
ElseIf Nilaiakhir < 45 Then
index = "E"
predikat = "Sangat Kurang"

End If
txtI.Text = index
txtPT.Text = predikat
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button2.Click
txtI.Text = ""
txtNA.Text = ""
txtPT.Text = ""
txtNT.Text = ""
txtNQ.Text = ""
txtNUT.Text = ""
txtNUA.Text = ""
txtNT.Select()
End Sub
End Class
No. 4 :
Public Class Form2
Dim hargabarang, quantity, subTot, tobar As Integer
Dim nama, kode, diskon As String
Private Sub Cbkode_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Cbkode.SelectedIndexChanged
kode = Cbkode.Text
If kode = "A01" Then
nama = "Speaker"
hargabarang = 50000
ElseIf kode = "B02" Then
nama = "Mouse"
hargabarang = 25000
ElseIf kode = "C03" Then
nama = "Harddisk"
hargabarang = 750000
Else : kode = "D04"
nama = "Mouse pad"
hargabarang = 5000

End If
txtNB.Text = nama
txtHB.Text = Format(hargabarang, "#,##0")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
quantity = txtQty.Text
subTot = hargabarang * quantity
txtSub.Text = Format(subTot, "#,##0")

If subTot >= 100000 Then


diskon = 15%
tobar = subTot - (subTot * 15 / 100)
ElseIf subTot >= 500000 Then
diskon = 10%
tobar = subTot - (subTot * 15 / 100)

ElseIf subTot >= 25000 Then


diskon = 5%
tobar = subTot - (subTot * 15 / 100)

ElseIf subTot < 25000 Then


diskon = 0%
tobar = subTot - (subTot * 15 / 100)
End If
txtDiskon.Text = diskon
txtTB.Text = Format(tobar, "#,##0")
End Sub

Private Sub Button2_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button2.Click
txtDiskon.Text = ""
txtHB.Text = ""
txtQty.Text = ""
txtNB.Text = ""
txtSub.Text = ""
txtDiskon.Text = ""
txtTB.Text = ""
Cbkode.Text = ""
txtQty.Select()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
End Class
No. 5 :
Public Class Form1
Dim kode, kota As String
Dim harga, jumlah, total, bayar, kembali As Integer
Private Sub cbkode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cbkode.SelectedIndexChanged
kode = cbkode.Text
If kode = "MDN 1" Then
kota = "Bandung"
ElseIf kode = "MDN 2" Then
kota = "Surabaya"
Else : kode = "MDN 1"
kota = "Makasar"
End If
txtkota.Text = kota
End Sub

Private Sub rbekonomi_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rbekonomi.CheckedChanged
kode = cbkode.Text
If kode = "MDN 1" Then
harga = 200000
ElseIf kode = "MDN 2" Then
harga = 350000
Else : kode = "MDN 3"
harga = 750000
End If
txtharga.Text = Format(harga, "#,##0")
End Sub

Private Sub rbbisnis_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rbbisnis.CheckedChanged
kode = cbkode.Text
If kode = "MDN 1" Then
harga = 275000
ElseIf kode = "MDN 2" Then
harga = 425000
Else : kode = "MDN 3"
harga = 875000
End If
txtharga.Text = Format(harga, "#,##0")
End Sub

Private Sub rbvip_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rbvip.CheckedChanged
kode = cbkode.Text
If kode = "MDN 1" Then
harga = 345000
ElseIf kode = "MDN 2" Then
harga = 535000
Else : kode = "MDN 3"
harga = 955000
End If
txtharga.Text = Format(harga, "#,##0")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
harga = txtharga.Text
jumlah = txtjumlah.Text
total = jumlah * harga
txttotal.Text = Format(total, "#,##0")

bayar = txtbayar.Text
kembali = bayar - total
txtkembali.Text = Format(kembali, "#,##0")
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
txtnama.Text = ""
txtalamat.Text = ""
cbkode.Text = ""
txtjumlah.Text = ""
txtharga.Text = ""
txtkota.Text = ""
txttotal.Text = ""
txtbayar.Text = ""
txtkembali.Text = ""
txtnama.Select()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
End
End Sub
End Class
N0. 6 :
Public Class Form1
Dim kode, pemakaian As String
Dim biaya, topem, tobi, abodemen As Integer
Private Sub cbgol_SelectedIndexChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cbgol.SelectedIndexChanged
kode = cbgol.Text
If kode = "A1" Then
abodemen = "30.000"
ElseIf kode = "B2" Then
abodemen = "60.000"
Else : kode = "C3"
abodemen = "75000"
End If
txtabo.Text = Format(abodemen, "#,##0")
End Sub

Private Sub rb1_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rb1.CheckedChanged

biaya = 1500
txtbiaya.Text = Format(biaya, "#,##0")
End Sub

Private Sub rb2_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rb2.CheckedChanged

biaya = 3000
txtbiaya.Text = Format(biaya, "#,##0")
End Sub

Private Sub rb3_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rb3.CheckedChanged

biaya = 4500
txtbiaya.Text = Format(biaya, "#,##0")
End Sub

Private Sub rb4_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rb4.CheckedChanged

biaya = 6000
txtbiaya.Text = Format(biaya, "#,##0")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
pemakaian = txtpemakaian.Text
biaya = txtbiaya.Text
topem = pemakaian * biaya
txttopem.Text = Format(topem, "#,##0")

abodemen = txtabo.Text
tobi = topem + abodemen
txttoya.Text = Format(tobi, "#,##0")
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
txtno.Text = ""
txtnama.Text = ""
cbgol.Text = ""
txtpemakaian.Text = ""
txtabo.Text = ""
txtbiaya.Text = ""
txttopem.Text = ""
txttoya.Text = ""
txtnama.Select()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
End
End Sub
End Class
No. 7 :

Public Class Form2


Dim kode, lama As String
Dim diskon, torif, tarif, tobi As Integer
Private Sub cbkode_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cbkode.SelectedIndexChanged
kode = cbkode.Text
If kode = "1A" Then
tarif = "400.000"
ElseIf kode = "2B" Then
tarif = "300.000"
Else : kode = "3C"
tarif = "150000"
End If
txttarif.Text = Format(tarif, "#,##0")
End Sub

Private Sub rb1_CheckedChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles rb1.CheckedChanged
diskon = 0.1 * torif
txtdiskon.Text = Format(diskon, "#,##0")
End Sub

Private Sub rb2_CheckedChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles rb2.CheckedChanged
diskon = 0.15 * torif
txtdiskon.Text = Format(diskon, "#,##0")
End Sub

Private Sub rb3_CheckedChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles rb3.CheckedChanged
diskon = 0.2 * torif
txtdiskon.Text = Format(diskon, "#,##0")
End Sub

Private Sub rb4_CheckedChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles rb4.CheckedChanged
diskon = 0.3 * torif
txtdiskon.Text = Format(diskon, "#,##0")
End Sub

Private Sub txtlama_TextChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles txtlama.TextChanged
lama = txtlama.Text
torif = lama * tarif
txttota.Text = Format(torif, "#,##0")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button1.Click
tobi = torif - diskon
txttobi.Text = Format(tobi, "#,##0")
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button2.Click
txtno.Text = ""
txtnama.Text = ""
cbkode.Text = ""
txttarif.Text = ""
txttota.Text = ""
txtdiskon.Text = ""
txttobi.Text = ""
txtlama.Clear()
txtnama.Select()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button3.Click
End
End Sub
End Class

You might also like