Public Class videoBonanzaForm
Dim videoBonanza(,) As String = {{"Comedy", "Aisle 1"}, {"Drama", "Aisle 2"}, {"Action", "Aisle 3"}, _
{"Sci-Fi", "Aisle 4"}, {"Horror", "Aisle 5"}, {"New Releases", "Back Wall"}}
Private Sub videoBonanzaForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub searchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles searchButton.Click
If categoriesListBox.SelectedIndex = -1 Then
MessageBox.Show("No Category Selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
Else
aisleLabel.Text = videoBonanza(categoriesListBox.SelectedIndex, categoriesListBox.SelectedIndex)
End If
End Sub
End Class
I get an error at the Else statement during run time. Why can I not access the element this way?