Hello, I basicaly not familiar with vb.net because I'm new to it but I need help for my assingment P.O.S System but I can't fin a way to deduct the amount that you want to remove from the list.
I always have this eror and I don't know if the coding is correct either I tried using SelectedIndex but the selected price of the item I choose didn't appear on the PriceTextBox so I try several ways that I can think of
the amount of the item selected in the listbox1 suppose to appear in the PriceTextBox so that when I click the void button it will deduct the total amount from the PriceTextBox but it's not working
can anyone help or give links to same problems..thanks.
these are the coding I used
VOID BUTTON:
Private Sub Button5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
TextBox1.Text = Val(TextBox1.Text) - Val(PriceTextBox.Text)
End Sub
SELECTING FROM LISTBOX:
I tried to swap from SelectedItem and SelectedIndex and then using them both them swaping their positions but I still can't get it
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedItem.Equals("c1 90") Then
ListBox1.SelectedIndex.Equals("c1 90")
MealComboBox.Text = "c1"
PriceTextBox.Text = "90"
End If
If ListBox1.SelectedIndex.Equals("c2 100") Then
ListBox1.SelectedItem.Equals("c2 100")
MealComboBox.Text = "c2"
PriceTextBox.Text = "100"
End If
If ListBox1.SelectedIndex.Equals("c3 150") Then
ListBox1.SelectedItem.Equals("c3 150")
MealComboBox.Text = "c3"
PriceTextBox.Text = "150"
End If
If ListBox1.SelectedIndex.Equals("c4 200") Then
ListBox1.SelectedItem.Equals("c4 200")
MealComboBox.Text = "c4"
PriceTextBox.Text = "200"
End If
If ListBox1.SelectedIndex.Equals("b1 390") Then
ListBox1.SelectedItem.Equals("b1 390")
MealComboBox.Text = "b1"
PriceTextBox.Text = "390"
End If
If ListBox1.SelectedIndex.Equals("b2 450") Then
ListBox1.SelectedItem.Equals("b2 450")
MealComboBox.Text = "b2"
PriceTextBox.Text = "450"
End If
End Sub