0% found this document useful (0 votes)
24 views3 pages

Nama: Rizky Sandy Syabana Kelas: Pemrograman VB-B NIM: 1610512070

This document contains code for a refrigerator application program written in VB. The program uses buttons, labels, and textboxes to allow the user to add or remove the number of meat items displayed. It initializes arrays to store the meat names and values. When the "add meat" button is clicked, it will increase the count and refresh the display. When the "remove meat" button is clicked, it will decrease the count and refresh. The program prevents invalid operations like overfilling or emptying the refrigerator.

Uploaded by

Rahmat Septiyadi
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)
24 views3 pages

Nama: Rizky Sandy Syabana Kelas: Pemrograman VB-B NIM: 1610512070

This document contains code for a refrigerator application program written in VB. The program uses buttons, labels, and textboxes to allow the user to add or remove the number of meat items displayed. It initializes arrays to store the meat names and values. When the "add meat" button is clicked, it will increase the count and refresh the display. When the "remove meat" button is clicked, it will decrease the count and refresh. The program prevents invalid operations like overfilling or emptying the refrigerator.

Uploaded by

Rahmat Septiyadi
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/ 3

Nama: Rizky Sandy Syabana

Kelas: Pemrograman VB-B

NIM: 1610512070

INTERFACE
/SYNTAX/
Public Class Form1
Dim daging(49) As String
Dim w, x, y, z As Integer
Dim i, n, m As Integer
Dim a, b, c, d As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
Dim i = 26
Dim a As Integer
For a = 0 To i - 1
If a < 9 Then
daging(a) = ("DB" & i + a - 1)
ListBox1.Items.Add(a + 1 & (". ") & daging(a))
ElseIf a >= 9 Then
daging(a) = ("DB" & i + a - 1)
ListBox1.Items.Add(a + 1 & (". ") & daging(a))
End If
Next
Label1.Text = i
m = i + a - 2
'Novalino Reynaldi Anas 1610512047
Label7.Text = 50 - Val(Label1.Text)
End Sub

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


System.EventArgs) Handles Button1.Click
Dim a, b, c, d, n, m As Integer
b = Label1.Text
a = TextBox1.Text
c = b + a
d = 26 + n
ListBox1.Items.Clear()
For n = 0 To c - 1
If n < 9 Then
daging(n) = ("DB" & d + n - 1)
ListBox1.Items.Add(n + 1 & (". ") & daging(n))
ElseIf n >= 9 Then
daging(n) = ("DB" & d + n - 1)
ListBox1.Items.Add(n + 1 & (". ") & daging(n))
End If
Next
Label1.Text = c
'Novalino Reynaldi Anas 1610512047
Label7.Text = 50 - Val(Label1.Text)
If Val(Label7.Text) = 0 Then
MsgBox("KULKAS SUDAH PENUH YA")
End If

If Val(Label1.Text) = 50 Then
Button1.Enabled = False
Else
Button1.Enabled = True
End If

If Val(Label1.Text) = 0 Then
Button2.Enabled = False
Else
Button2.Enabled = True
End If
End Sub

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


System.EventArgs) Handles Button2.Click
Dim x, y, z, w, n As Integer
x = label1.text
y = TextBox1.Text
z = x - y
w = m
ListBox1.Items.Clear()
For n = 0 To z - 1
If n < 9 Then
daging(y + 1) = ("DB" & w - x + 1 + y + n)
daging(n) = daging(y + 1)
ListBox1.Items.Add(n + 1 & (". ") & daging(n))
ElseIf n >= 9 Then
daging(y + 1) = ("DB" & w - x + 1 + y + n)
daging(n) = daging(y + 1)
ListBox1.Items.Add(n + 1 & (". ") & daging(n))
End If
Next
Label1.Text = z
'Novalino Reynaldi Anas 1610512047
Label7.Text = 50 - Val(Label1.Text)
If Val(Label7.Text) = 50 Then
MsgBox("KULKAS KOSONG NIH")
End If

If Val(Label1.Text) = 50 Then
Button1.Enabled = False
Else
Button1.Enabled = True
End If

If Val(Label1.Text) = 0 Then
Button2.Enabled = False
Else
Button2.Enabled = True
End If
End Sub
End Class

Keterangan: Program kulkas ini dibuat dengan menggunakan tool button, label, dan textbox. Aplikasi
kulkas ini bisa melakukan pengurangan dan penjumlahan jumlah daging. Jika kita memasukan jumlah
daging pada kolom textbox dan lalu mengklik button ambil daging maka stok daging akan berkurang.
Sebaliknya jika kita memasukan jumlah daging dan mengklik button masukan daging, maka stol daging
akan bertambah.

You might also like