Click here to Skip to main content
15,916,949 members
Home / Discussions / C#
   

C#

 
GeneralRe: set time limit in thread Pin
cocoonwls7-Feb-07 21:10
cocoonwls7-Feb-07 21:10 
QuestionRead an element XML Pin
picasso22-Feb-07 18:09
picasso22-Feb-07 18:09 
AnswerRe: Read an element XML Pin
picasso22-Feb-07 18:12
picasso22-Feb-07 18:12 
AnswerRe: Read an element XML Pin
Christian Graus2-Feb-07 18:18
protectorChristian Graus2-Feb-07 18:18 
AnswerRe: Read an element XML Pin
blue_arc3-Feb-07 1:58
blue_arc3-Feb-07 1:58 
QuestionScary Object reference problem in OCR application. Pin
Nitin19812-Feb-07 15:13
Nitin19812-Feb-07 15:13 
QuestionTextbox control Pin
alostdruid2-Feb-07 15:09
alostdruid2-Feb-07 15:09 
AnswerRe: Textbox control Pin
Christian Graus2-Feb-07 15:56
protectorChristian Graus2-Feb-07 15:56 
This is a common question, but the solution is a little complex, at least for a beginner.  The answer is to handle the KeyPress event for the control, and to check if the key is what you want, or to reject it.  Setting Handled to true on the event args rejects the keypress, so the code is something like:

e.Handled = ! ( Char.IsNumeric(e.KeyChar) || Char.IsControl(e.KeyChar));

No warranty expressed or implied on the above line, it's a guess

Or you can use a masked edit control.


Christian Graus - C++ MVP

'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

GeneralRe: Textbox control Pin
alostdruid2-Feb-07 16:11
alostdruid2-Feb-07 16:11 
GeneralRe: Textbox control Pin
Christian Graus2-Feb-07 16:24
protectorChristian Graus2-Feb-07 16:24 
GeneralRe: Textbox control [modified] Pin
alostdruid2-Feb-07 16:45
alostdruid2-Feb-07 16:45 
GeneralRe: Textbox control Pin
Luc Pattyn2-Feb-07 17:08
sitebuilderLuc Pattyn2-Feb-07 17:08 
GeneralRe: Textbox control Pin
Christian Graus2-Feb-07 17:21
protectorChristian Graus2-Feb-07 17:21 
QuestionRe: Textbox control Pin
alostdruid5-Feb-07 15:00
alostdruid5-Feb-07 15:00 
AnswerRe: Textbox control Pin
Christian Graus5-Feb-07 17:11
protectorChristian Graus5-Feb-07 17:11 
Questionaccess application settings in from code in windows application Pin
red60mans2-Feb-07 15:03
red60mans2-Feb-07 15:03 
QuestionArrays of structures (inside a structure) Pin
Kim Ferrari2-Feb-07 13:10
Kim Ferrari2-Feb-07 13:10 
AnswerRe: Arrays of structures (inside a structure) Pin
Luc Pattyn2-Feb-07 13:27
sitebuilderLuc Pattyn2-Feb-07 13:27 
GeneralRe: Arrays of structures (inside a structure) Pin
Kim Ferrari5-Feb-07 12:51
Kim Ferrari5-Feb-07 12:51 
QuestionMouseClick event on wia video overlay Pin
stevva2-Feb-07 12:58
stevva2-Feb-07 12:58 
AnswerRe: MouseClick event on wia video overlay Pin
Luc Pattyn2-Feb-07 13:04
sitebuilderLuc Pattyn2-Feb-07 13:04 
GeneralRe: MouseClick event on wia video overlay Pin
stevva3-Feb-07 4:39
stevva3-Feb-07 4:39 
GeneralRe: MouseClick event on wia video overlay Pin
Luc Pattyn3-Feb-07 5:27
sitebuilderLuc Pattyn3-Feb-07 5:27 
GeneralRe: MouseClick event on wia video overlay Pin
stevva6-Feb-07 6:21
stevva6-Feb-07 6:21 
Questionprogress bar Pin
netJP12L2-Feb-07 10:46
netJP12L2-Feb-07 10:46 

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.