
Originariamente inviata da
pietro09
ci provo
dipende cosa c'è dentro il listbox. Se ci sono stringhe, tipo per esempio:
Me.ListBox1.Items.AddRange(New Object() {"", "Stefano", "Carlo", "Nicola", "Pietro", "Lucia"})
farei così:
codice:
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
Dim c As ListBox = DirectCast(sender, ListBox)
Dim item As String = c.SelectedItem.ToString
If String.IsNullOrWhiteSpace(item) Then
Label1.Text = "VUOTO"
Else
Label1.Text = "Non vuoto"
End If
End Sub