Tugas VB

A. Nomor  Satu

Dim kesempatan As Integer

_____________________________________________________________________

Private Sub cmdOK_Click()

kesempatan = kesempatan + 1

If (LCase(txtPass.Text) = “nusantara”) And (kesempatan <= 3) Then

Image1.Visible = True

txtPass.Enabled = False

Command1.Enabled = False

Else

MsgBox “Passwordnya Salah !”

If kesempatan < 3 Then

txtPass.Text = “”

txtPass.SetFocus

Else

End

End If

End If

End Sub

_______________________________________________________________________

B.  Nomor ke dua

Private Sub lstBarang_Click()

Dim Harga As Currency

Dim Satuan As String

____________________________________

Select Case lstBox.Text

Case “CD Blank”

Harga = 85000

Satuan = “Box”

Case “Buku Tulis”

Harga = 36000

Satuan = “Lusin”

Case “Kertas”

Harga = 28000

Satuan = “Rim”

Case “Bolpoin”

Harga = 15000

Satuan = “Pak”

End Select

lblHarga.Caption = Harga

lblSatuan.Caption = Satuan

End Sub

________________________________

Private Sub cmdEnd_Click()

End

End Sub

C. Tugas Nomo tiga

Private Sub Form_Load()

List1.AddItem “CD Blank”

List1.AddItem “Buku Tulis”

List1.AddItem “Kertas”

List1.AddItem “Bolpoin”

End Sub

_____________________________________________________________

Private Sub Command1_Click()

Dim harga As Currency, total As Currency

Dim jumlah As Integer

Dim diskon As Single

Dim satuan As String

If List1.Text = “” Then

MsgBox “Anda belum memilih barang !!”

List1.ListIndex = 0

Exit Sub

End If

If Text1.Text = “” Then

MsgBox “Anda belum mengisi jumlah barang !!”

Text1.SetFocus

Exit Sub

End If

If Not IsNumeric(Text1.Text) Then

MsgBox “Isi jumlah barang harus angka !!”

Text1.SetFocus

Exit Sub

End If

Select Case List1.Text

Case “CD Blank”

harga = 850000

satuan = “Box”

Case “Buku”

harga = 36000

satuan = “Lusin”

Case “Kertas”

harga = 28000

satuan = “Rim”

Case “Pulpen”

harga = 15000

satuan = “Pak”

End Select

__________________________________________

lblBarang.Caption = “Barang : ” & List1.Text

lblHarga.Caption = “Harga : ” & Format(harga, “Currency”) & “/” & satuan

lblJumlah.Caption = “Jumlah : ” & txtjumlah.Text & ” ” & satuan

jumlah = Text1.Text

Select Case jumlah

Case Is =< 5

diskon = 0.5

Case Else

diskon = 0

End Select

total = jumlah * (harga * (1 – diskon))

lblDiskon.Caption = “Diskon : ” & Format(diskon, “0 %”)

lblTotal.Caption = “Total Bayar : ” & Format(total, “Currency”)

End Sub

_______________________________________________________________________

Satu Tanggapan

  1. wihiii ,salam kenal sobat

Komentar ditutup.

%d blogger menyukai ini: