On Tue, 12 Dec 2006 14:02:47 +0800, ad wrote:
Thanks,
How can I use regex expression?
"Duggi" <Du***************@gmail.com>
???????:11**********************@j44g2000cwa.googl egroups.com...
>Hi
If you are using winforms Masked Textbox would be appropriate choice.
Drag drop masked text box on to window form and set the mask property
to custom mask and put mask as AAAAAAAAAAAAAAAAAAA.
only pain point is you need to know the number of chars.
Hope this solves the issue at hand.
Thanks
-Srinivas.
ad wrote:
>>I want to limit the input of usr to 0..9 or a..z
How can I do that?
Hey ad,
Here's a small program to do what you want
First, put this in the class imports
using System.Text.RegularExpressions;
Then run this
public static void Main()
{
//
// Get the input
//
string inputString="aA";
Console.WriteLine(IsValid(inputString));
Console.ReadLine();
}
//
// This function validates the input
//
static bool IsValid(string s){
//
// Create a regex
//
Regex r = new Regex(@"^[0-9a-z]*$");
//
// Check if the input matches
//
return r.IsMatch(s);
}
--
Bits.Bytes
http://bytes.thinkersroom.com