Question Visual Studio 8.0 not allowing use of Ctrl key

Joined
Jan 13, 2009
Messages
5
Programming Experience
Beginner
I am using the following code below. It should allow me to use the Control key to select multiple items from the listbox1, but for some reason when I run the code I am not able to do so. Is there a solution for this behavior?
VB.NET:
Option Explicit On
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim i As Integer
        For i = 0 To ListBox1.SelectedItems.Count - 1
            Select Case ListBox1.SelectedItems(i).ToString()
                Case "Foobar"
                    MessageBox.Show("Foobar")
                Case "Bazquirk"
                    MessageBox.Show("Bazquirk")
                Case "Widgets"
                    MessageBox.Show("Widgets")
                Case "Gadgets"
                    MessageBox.Show("Gadgets")
            End Select
        Next
    End Sub
End Class
 
What would be the exact snytax for the multisimple?
Go to Designer view and select the control, go to Properties window and locate the SelectionMode property, select one of the valid values in the dropdown list.
 
Back
Top