|
-
Jul 15th, 2006, 05:35 AM
#1
Thread Starter
Addicted Member
Disable the effect of DEL key.
Hi Guys,
Is there anyway by which I can disable the effect of DEL key using VB.Net. I am developing a desktop application. What I want is the user should not be able to del key or ctrl-X or ctrlC when the focus is on the text box.
Any answers?
Please let me know.
Regards,
Samir.
-
Jul 15th, 2006, 06:07 AM
#2
Re: Disable the effect of DEL key.
VB Code:
Private Sub MyTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Delete Then
End If
If e.Control And e.KeyCode = Keys.C Then
End If
If e.Control And e.KeyCode = Keys.V Then
End If
End Sub
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Jul 16th, 2006, 04:22 AM
#3
Thread Starter
Addicted Member
Re: Disable the effect of DEL key.
Thanx a lot buddy.
I tried the same thing but it didn't work. Probaby because i traped the keypress and the keyup events.
Regards,
Samir.
-
Jul 16th, 2006, 06:37 AM
#4
Re: Disable the effect of DEL key.
If you want to disable a Key in KeyDown/KeyPress or KeyUp events, you should use e.Handled = true to let windows know that the key was handled by the window. Like this
VB Code:
If e.KeyCode = Keys.Delete Then
e.Handled = True
End If
Use [code] source code here[/code] tags when you post source code.
My Articles
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|