Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi. I want to catch if delete key was pressed in listbox control.

 

 

   Private Sub ListBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ListBox1.KeyPress
       Me.Text = e.KeyChar
       Select Case e.KeyChar

       End Select

 

in this code just characters are recognised. If I press 'Del' nothing happens.

 

 

any help.

 

 

tx

matej

  • *Experts*
Posted

Give this a try.

   Private Sub ListBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ListBox1.KeyDown
       If e.KeyCode = Keys.Delete Then
           MessageBox.Show("delete")
       End If
   End Sub

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...