Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TextBox
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00763877
Message ID:
00763900
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Wilson,

You need to handle the KeyPress event. You check for whatever key you want to trap and then you can set the Handled property of the KeyEventArgs instance passed to your method to true and it will indicate that you have handled the event (and you do nothing, of course).

This example traps the Enter key:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
        e.Handled = True
    End If
End Sub
>How do i cancel a Key stroke in .NET. like in VB 6 by asigning 0 to the KeyAscii variable.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform