Combo Box row selected
-
I have a list of records in a combo box. How do I get the selected row number e.g. In combo box have the following A B C D If I select C then that is the 3rd row. How do I display that I selected the 3rd row. Thanks in advance
-
I have a list of records in a combo box. How do I get the selected row number e.g. In combo box have the following A B C D If I select C then that is the 3rd row. How do I display that I selected the 3rd row. Thanks in advance
combobox1.selectedindex + 1 = the row number its +1 cause combobox index starts at 0 so the first item is at index 0 and the last is at count-1 in other words assuming the combobox is called combobox1 and the output is going to be in label1
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Label1.Text = "You Clicked On row " & (ComboBox1.SelectedIndex + 1).ToString End Sub