Windows Develop Bookmark and Share   
 index > Windows Forms General > MaskedTextBox and Currency
 

MaskedTextBox and Currency

I am using xaml/wpf but I haven't found any support for MaskedTextBox so I am hosting a Forms control: MaskedTextBox.

I set the Mask to "999.99" - trouble is I have to enter three numerics before I can enter a decimal.
Is there anyway I can configure the mask so if I hit the decimal, what's to the left stays on the left, and the cursor goes to the right of the decimal so I can enter 1.23 12.23 etc?
ZiggyShort  Thursday, March 27, 2008 6:48 PM

Hi,

The System.Windows.Forms.MaskedTextBox doesn't support the function you want so far. I suggest that you create a new class derived from the TextBox class, which only allows numbers in it.

The base class can be System.Windows.Forms.TextBox or the System.Windows.Controls.TextBox class. For the former case, you need to host the custom control usingthe WindowsFormsHostin your WPF application; for the latter case, you can use it in the WPF application directly.

Hope this helps.

If you have any question, please feel free to let me know.

Linda

Linda Liu  Monday, March 31, 2008 8:41 AM

Hi,

The System.Windows.Forms.MaskedTextBox doesn't support the function you want so far. I suggest that you create a new class derived from the TextBox class, which only allows numbers in it.

The base class can be System.Windows.Forms.TextBox or the System.Windows.Controls.TextBox class. For the former case, you need to host the custom control usingthe WindowsFormsHostin your WPF application; for the latter case, you can use it in the WPF application directly.

Hope this helps.

If you have any question, please feel free to let me know.

Linda

Linda Liu  Monday, March 31, 2008 8:41 AM

You can use google to search for other answers

Custom Search

More Threads

• Able to detect SerialDataReceiveEvent in a function?
• How to change default language of a TextBox?
• Printing Windows Forms
• Generating a form of varying type at runtime
• Resource files in text format, whitespace and Resgen.exe
• Embedded Windows Media Player in Form (ActiveX)
• filling and sending forms in c#
• Changing the Screen Resolution.....but what about the Monitor Frequency??
• IME Mode Setting Progrmatically
• Document_Completed is showing more then once on one WWW. How to determine page is loaded?