Public Class Form1
Dim just(5, 3) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim row As Integer
Dim col As Integer
Dim vac As String()
vac = New String(just.GetUpperBound(0)) {}
ListBox1.Items.Clear()
For row = 0 To just.GetUpperBound(0) - 1
For col = 1 To just.GetUpperBound(1)
vac(row) = "Vacant"
If row = 0 And col = 1 Then
vac(row) = "Reserved"
ElseIf row = 0 And col = 2 Then
vac(row) = "Reserved"
ElseIf row = 2 And col = 1 Then
vac(row) = "Reserved"
ElseIf row = 2 And col = 2 Then
vac(row) = "Reserved"
End If
ListBox1.Items.Add(row & " " & Chr(64 + col).ToString & " " & vac(row.ToString) & " ")
Next
Next
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Dim reserd As String = ListBox1.SelectedItem.ToString
If reserd.ToLower.EndsWith("vacant ") Then
ListBox1.Items(ListBox1.SelectedIndex) = reserd.ToString.Substring(0, reserd.Length - 7) & "Reserved "
Else
ListBox1.Items(ListBox1.SelectedIndex) = reserd.ToString.Substring(0, reserd.Length - 9) & "Vacant "
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim col As Integer
Dim row As Integer
Dim total As Integer
For row = 0 To 5 - 1
For col = 1 To 3
total = row * col
TextBox1.Text = total
Next
Next
End Sub
End Class
I will want to include a combobox with some options of a. alltheseat b. Vacantseats., c. Reservedseats.
My question is how do I write the code that when vacant seat is selected from the combobox it will list only the vacant seats in the listbox and when reservedseats is selected it will list only on the reserved seats.
Thank you

New Topic/Question
Reply




MultiQuote






|