We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,608 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Disable Paste on Textbox

Alright, I have Textbox where I want only Numbers and Letters and backspace allowed.
I don't want copy and paste, or spacebar or other ascii charachters.
Can anybody help me?

1
Contributor
1
Reply
41 Minutes
Discussion Span
1 Year Ago
Last Updated
3
Views
Question
Answered
Aangiix3
Newbie Poster
22 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Solved by my own.
Here's the Code:

Private Sub Username_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Username.KeyPress
Select Case e.KeyChar
Case Chr(65) To Chr(90), Chr(48) To Chr(57), Chr(8) 'allows a-z and 0-9 plus backspace
Case Chr(97) To Chr(122), Chr(8) 'allows a-z plus backspace
Case Else 'everything else than above
e.KeyChar = Chr(0) 'wont be accepted
End Select
End Sub
Aangiix3
Newbie Poster
22 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Self-Answered as of 1 Year Ago

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0626 seconds using 2.62MB