Click here to Skip to main content
15,917,541 members
Home / Discussions / C#
   

C#

 
GeneralRe: Scan and Compare Pin
Eolus6-Apr-04 21:04
Eolus6-Apr-04 21:04 
GeneralRe: Scan and Compare Pin
Bill Dean7-Apr-04 2:37
Bill Dean7-Apr-04 2:37 
GeneralRe: Scan and Compare Pin
Heath Stewart7-Apr-04 3:12
protectorHeath Stewart7-Apr-04 3:12 
GeneralRe: Scan and Compare Pin
Eolus7-Apr-04 3:32
Eolus7-Apr-04 3:32 
GeneralRe: Scan and Compare Pin
Heath Stewart7-Apr-04 3:37
protectorHeath Stewart7-Apr-04 3:37 
GeneralRe: Scan and Compare Pin
Bill Dean7-Apr-04 7:01
Bill Dean7-Apr-04 7:01 
GeneralTextBox Paste Pin
Simon Wren6-Apr-04 3:00
professionalSimon Wren6-Apr-04 3:00 
GeneralRe: TextBox Paste Pin
Heath Stewart6-Apr-04 3:34
protectorHeath Stewart6-Apr-04 3:34 
If you've extended TextBox with your own, override OnValidating; otherwise, handle the Validating event. This allows you to cancel the operation if anything but numbers are pasted and will restore the previous text (since Validating fires before the Text is set). See the documentation for the Validating event to see an order of events. The only problem with this method is that the control must loose focus first.

If that's not sufficient, then extend TextBox (if you haven't already) and override WndProc. Handle the WM_PASTE notification message (0x0302) and throw it out (i.e., don't call base.WndProc) if the Clipboard text doesn't contain numbers. You could handle this a few other ways, but hopefully this will get you started.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: TextBox Paste Pin
Simon Wren6-Apr-04 3:37
professionalSimon Wren6-Apr-04 3:37 
QuestionHow I may safe close my application? Pin
novitzky6-Apr-04 2:59
novitzky6-Apr-04 2:59 
AnswerRe: How I may safe close my application? Pin
Simon Wren6-Apr-04 3:06
professionalSimon Wren6-Apr-04 3:06 
GeneralRe: How I may safe close my application? Pin
Heath Stewart6-Apr-04 3:40
protectorHeath Stewart6-Apr-04 3:40 
GeneralRe: How I may safe close my application? Pin
Simon Wren6-Apr-04 3:46
professionalSimon Wren6-Apr-04 3:46 
GeneralRe: How I may safe close my application? Pin
Heath Stewart6-Apr-04 3:51
protectorHeath Stewart6-Apr-04 3:51 
AnswerRe: How I may safe close my application? Pin
LongRange.Shooter6-Apr-04 3:08
LongRange.Shooter6-Apr-04 3:08 
AnswerRe: How I may safe close my application? Pin
Colin Angus Mackay6-Apr-04 3:11
Colin Angus Mackay6-Apr-04 3:11 
AnswerRe: How I may safe close my application? Pin
novitzky6-Apr-04 4:22
novitzky6-Apr-04 4:22 
GeneralDisabling Text Wrap on DrawString() Pin
Tristan Rhodes6-Apr-04 2:54
Tristan Rhodes6-Apr-04 2:54 
GeneralRe: Disabling Text Wrap on DrawString() Pin
Heath Stewart6-Apr-04 3:23
protectorHeath Stewart6-Apr-04 3:23 
QuestionDirect X transformation? Pin
SherKar6-Apr-04 2:53
SherKar6-Apr-04 2:53 
AnswerRe: Direct X transformation? Pin
Heath Stewart6-Apr-04 3:22
protectorHeath Stewart6-Apr-04 3:22 
GeneralRe: Direct X transformation? Pin
SherKar7-Apr-04 4:29
SherKar7-Apr-04 4:29 
GeneralRe: Direct X transformation? Pin
Heath Stewart7-Apr-04 5:17
protectorHeath Stewart7-Apr-04 5:17 
GeneralRe: .NET Pin
CWIZO6-Apr-04 2:41
CWIZO6-Apr-04 2:41 
GeneralRe: .NET Pin
Colin Angus Mackay6-Apr-04 2:45
Colin Angus Mackay6-Apr-04 2:45 

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.