Hi - I am new to
VB and I'm working on a project. I have a list box where users can select more than one name from a list. I can't seem to get my code to work. Any suggestions? I think I'm missing a piece of the code but for the life of me, I can't figure it out. Here is my code.
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles _
Me.Load
' fills the list box with values
namesListBox.Items.Add(Convert.ToString("Debbie"))
namesListBox.Items.Add(Convert.ToString("Bill"))
namesListBox.Items.Add(Convert.ToString("Jim"))
namesListBox.Items.Add(Convert.ToString("Ahmad"))
namesListBox.Items.Add(Convert.ToString("Carol"))
namesListBox.SelectedIndex = 0
End Sub
Private Sub multiButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles _
multiButton.Click
Dim SELECTED_NAMES As String
For INDEX As Integer = 0 To namesListBox.SelectedItems.Count - 1
SELECTED_NAMES = namesListBox.SelectedItems.ToString & " " &
resultLabel.Text.ToString & " " &
ControlChars.NewLine
INDEX += 1
Next INDEX
End Sub
Any suggestions would be greatly appreciated. Thanks!
Jewel