Windows Develop Bookmark and Share   
 index > Windows Forms Designer > mimic MaskedTextBox.TextMaskFormat
 

mimic MaskedTextBox.TextMaskFormat

I am overrideing the textbox control to allow for numeric input only. But I am also providing Mask capabilities to the textbox. Everything works as I would like it to work, but I'd like tomimic the MaskedTextBox.TextMaskFormatIncludeLiterals functionality. The idea is that if I have "$3, 231.44" in the textbox that overriddenTextbox1.Text would return "3231.44".

I have a method that removes the formating on the mask (not the issue). The problem is thatoverriding the Text property to return RemoveFormat(Text) it gives me functionality problems on the UI.

Any Suggestions?
koenyn  Monday, February 16, 2009 2:11 PM
Hi koenyn,

Text property of textbox is getting or setting the text contents of the textbox. So if modify the text property will change the contents displayed in the textbox. Thisdoesn't like the markedtextbox control. Why not use maskedtextbox,maskedtextbox will be more convenient to expand. If you want to use text box to implemet this function, you will need to filter the string.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Friday, February 20, 2009 8:12 AM
Hi koenyn,

Text property of textbox is getting or setting the text contents of the textbox. So if modify the text property will change the contents displayed in the textbox. Thisdoesn't like the markedtextbox control. Why not use maskedtextbox,maskedtextbox will be more convenient to expand. If you want to use text box to implemet this function, you will need to filter the string.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Friday, February 20, 2009 8:12 AM

You can use google to search for other answers

Custom Search

More Threads

• Serialize events in a designer
• Suppress components to be shown in toolbox
• An unhandled win32 exception occurred in devenv.exe
• dragging controls during runtime
• Docking and ClientRectangle in custom control
• UserControl(ContainerControl) Receiving Focus
• on button click change mouse cursor
• Adding a ScrollBar to a frame
• unload a dll
• Windows Forms Layout Problem - FlowLayoutPanel AutoSized & Docked Top has Zero Height