Click here to Skip to main content
15,881,092 members
Home / Discussions / C#
   

C#

 
QuestionDo a check in a textBox Pin
lourensG19-Sep-07 22:13
lourensG19-Sep-07 22:13 
AnswerRe: Do a check in a textBox Pin
Giorgi Dalakishvili19-Sep-07 22:22
mentorGiorgi Dalakishvili19-Sep-07 22:22 
AnswerRe: Do a check in a textBox Pin
Martin#19-Sep-07 22:35
Martin#19-Sep-07 22:35 
AnswerRe: Do a check in a textBox Pin
Nouman Bhatti19-Sep-07 23:50
Nouman Bhatti19-Sep-07 23:50 
GeneralRe: Do a check in a textBox Pin
Martin#19-Sep-07 23:55
Martin#19-Sep-07 23:55 
GeneralRe: Do a check in a textBox Pin
lourensG20-Sep-07 0:08
lourensG20-Sep-07 0:08 
GeneralRe: Do a check in a textBox Pin
Martin#20-Sep-07 0:11
Martin#20-Sep-07 0:11 
AnswerRe: Do a check in a textBox Pin
Pete O'Hanlon20-Sep-07 0:02
mvePete O'Hanlon20-Sep-07 0:02 
It's been suggested to you that you should check the KeyPressEventArgs for the OnKeyPress handler. The code would look like this:
private void txtNumber_KeyPress(object sender, KeyPressEventArgs e)
{
  if (!char.IsNumber(e.KeyChar))
    e.Handled = true;
}
This basically uses the IsNumber member of the char type to determine whether or not a number was pressed. If the user types anything other than a number, the Handled value is set to true. This basically tells the system to ignore that keypress.

Deja View - the feeling that you've seen this post before.

GeneralRe: Do a check in a textBox Pin
lourensG20-Sep-07 0:31
lourensG20-Sep-07 0:31 
GeneralRe: Do a check in a textBox Pin
Pete O'Hanlon20-Sep-07 0:38
mvePete O'Hanlon20-Sep-07 0:38 
QuestionStream to Icon Pin
Michael Sync19-Sep-07 22:02
Michael Sync19-Sep-07 22:02 
AnswerRe: Stream to Icon Pin
Martin#19-Sep-07 22:23
Martin#19-Sep-07 22:23 
GeneralRe: Stream to Icon Pin
Michael Sync19-Sep-07 23:03
Michael Sync19-Sep-07 23:03 
AnswerRe: Stream to Icon Pin
J a a n s19-Sep-07 22:25
professionalJ a a n s19-Sep-07 22:25 
GeneralRe: Stream to Icon Pin
Michael Sync19-Sep-07 23:03
Michael Sync19-Sep-07 23:03 
JokeRe: Stream to Icon Pin
Malcolm Smart20-Sep-07 1:21
Malcolm Smart20-Sep-07 1:21 
GeneralRe: Stream to Icon Pin
Martin#20-Sep-07 1:28
Martin#20-Sep-07 1:28 
GeneralRe: Stream to Icon Pin
Michael Sync20-Sep-07 15:36
Michael Sync20-Sep-07 15:36 
GeneralRe: Stream to Icon Pin
Malcolm Smart20-Sep-07 20:56
Malcolm Smart20-Sep-07 20:56 
Questionhow to create tree nodes and save it as an xml Pin
Mamphekgo Bahula19-Sep-07 21:29
Mamphekgo Bahula19-Sep-07 21:29 
QuestionMultiple Windows Forms Programs Interacting? Pin
stephan.smolek19-Sep-07 21:06
stephan.smolek19-Sep-07 21:06 
AnswerRe: Multiple Windows Forms Programs Interacting? Pin
Dave Kreskowiak20-Sep-07 7:00
mveDave Kreskowiak20-Sep-07 7:00 
QuestionCapture the desktop of remote machine Pin
Anez.A19-Sep-07 20:46
Anez.A19-Sep-07 20:46 
AnswerRe: Capture the desktop of remote machine Pin
Dave Kreskowiak20-Sep-07 6:54
mveDave Kreskowiak20-Sep-07 6:54 
GeneralRe: Capture the desktop of remote machine Pin
Anez.A23-Sep-07 17:50
Anez.A23-Sep-07 17:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.