Results 1 to 2 of 2

Thread: cancel a keypress

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    cancel a keypress

    in VB6 you could cancel a keypress event by setting KeyAscii = 0

    is there a way to do this in .NET since the KeyChar property on EventArgs is read only?

  2. #2
    Lively Member
    Join Date
    Oct 2002
    Location
    Plantation, FL (USA)
    Posts
    66
    This example is for a combobox. You can use the Handled property.

    VB Code:
    1. Private Sub cmbAgents_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles cmbAgents.KeyPress
    2.         ' Prevents the user to edit the content of the combobox
    3.         e.Handled = True
    4.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width