Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a small form with a single textbox for data entry. I have got it so when you hit escape it closes the form. Using the below code, the system 'BEEPS' when this is done. How can I do this so there is no 'BEEP'

 

Private Sub frmAddResult_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress

 

If Asc(e.KeyChar) = 27 Then

GC.Collect()

Me.Close()

End If

 

End Sub

 

 

Thanks

 

Steve

  • Leaders
Posted

try e.Handled and see if it stops the beep, i'm not at home so cant test it out but it works for Keys.Enter

If Asc(e.KeyChar) = 27 Then
   GC.Collect()
   Me.Close()
   e.Handled = True '/// stop the Beep.
End If

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...