Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > Edit Masked TextBox in c#
 

Edit Masked TextBox in c#

Hi All,
I customized to edit Mask TextBox for validation IP address. I set Mask "000.000.000.000" and PromtChar is "_" so when enter data it appear
"12_.123._34._1_" not good.
I used RexgularExpressions for check a IP such as above.

if (!isRegExValid(this.Text, this.ValidationText))

{

isValid = false;

ShowError((this._errorMsg.Length == 0) ? _DEFAULT_INVALID_MSG : this._errorMsg);

}

else

{

if (this.RegExPatternMode == RegularExpressionModes.IP && !isRegExValidIP(Text))

{

isValid = false;

ShowError((this._errorMsg.Length == 0) ? _DEFAULT_INVALID_MSG : this._errorMsg);

}

else

isValid = true;

}







 
LuckyStarfo  Wednesday, July 27, 2005 12:11 PM
Try setting the .Mask property to 099.099.099.099
The '9' indicates an optional digit.
Also ensure that the .TextMaskFormat property is NOT set to .IncludePrompt
BenWillett  Tuesday, August 02, 2005 12:17 AM
U should put this question in the "Window Form General" Topic.
khiemvo  Thursday, July 28, 2005 2:31 AM
Try setting the .Mask property to 099.099.099.099
The '9' indicates an optional digit.
Also ensure that the .TextMaskFormat property is NOT set to .IncludePrompt
BenWillett  Tuesday, August 02, 2005 12:17 AM

You can use google to search for other answers

Custom Search

More Threads

• combobox in datagridview
• Impact of running 32-bit Windows Application in 64 bit machine.
• Is the third light supposed to be red?
• TaskVision Sample
• Excel Namespace
• Terrarium Status -- Contest, Framework 1.1
• TaskVision Installation Problem
• Why DataGridView always throw an NullReferenceException when input value at the first time after pressing ESC ??????????????
• Older version of terrarium that supports C++
• Host XSD Designer on Winform application