clear selected Listbox2.item

Ultrawhack

Well-known member
Joined
Jul 5, 2006
Messages
164
Location
Canada
Programming Experience
3-5
Thanks ! Can you please tell me how I can clear selected Listbox2.item by hitting the delete key ?
 
Please post unrelated questions in separate threads. Thank you for your cooperation.

VB.NET:
Private Sub ListBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles ListBox1.KeyUp
  Dim ix As Integer = ListBox1.SelectedIndex
  If e.KeyCode = Keys.Delete And ix <> -1 Then
    ListBox1.Items.RemoveAt(ix)
  End If
End Sub
 
Last edited:
My apologies about that. I did not know if the message was successfully posted. And the forum did not show it was moved.

Thanks for the help.
 
Back
Top