10 TIPs - To Become a Good Developer/Programmer
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Administrator
Admin
2.2k
1.4m
Combobox KeyPress Event
Apr 15 2003 12:31 PM
I have been looking around the Internet in hopes to find a way to restrict certian keys from being accepeted from a combobox control... I found an article that explains using the KeyPress Event and setting the KeyPressEventArg.Handled property to true. I thought is was heaven until I tried it... On a combobox I could not get it to restrict the keystrokes but when I past the exact same code into a textbox's Keypress event it worked like a charm. N E IDEAS. The following will not restrict numeric values from being entered private void CombopBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if ( char.IsDigit ( e.KeyChar ) ) e.Handled = true; } the following does restrict numeric values from being entered private void TextBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if ( char.IsDigit ( e.KeyChar ) ) e.Handled = true; } I don't get it? Jim Di Crescenzo
Reply
Answers (
1
)
Passing data between MDI-children
tab control