program to create restaurant menu using listbox and calculate total item and price
-----------------------------------------code---------------------------------------------------------
Public Class Form1
Dim v, b, n, m, s As Integer
Dim total As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox2.Items.Add(ListBox1.SelectedItem)
TextBox1.Text = ListBox2.Items.Count()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox2.Items.Remove(ListBox2.SelectedItem)
TextBox1.Text = ListBox2.Items.Count()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim a, i, j As Integer
j = 0
a = ListBox2.Items.Count
For i = 0 To a
If (i < a) Then
If ListBox2.Items(i) = "Vadapav(Rs.10)" Then
j = j + 10
End If
If ListBox2.Items(i) = "Barger(Rs.15)" Then
j = j + 15
End If
If ListBox2.Items(i) = "Noodles(Rs.35)" Then
j = j + 35
End If
If ListBox2.Items(i) = "Maggi(Rs.20)" Then
j = j + 20
End If
If ListBox2.Items(i) = "Sandwich(Rs.12)" Then
j = j + 12
End If
If ListBox2.Items(i) = "Chinese Puf(Rs.12)" Then
j = j + 12
End If
If ListBox2.Items(i) = "Samosa(Rs.15)" Then
j = j + 15
End If
End If
Next i
TextBox2.Text = j
End Sub
End Class-----------------------------------------output----------------------------------------------------
codestrew |
No comments:
Post a Comment