I want to validate customer input for ph# for eg in format (901) 348 3455. In VB6 we could use a
maskEdit control to format phone nos etc. How do we do that in
.NET. please suggest.
Printable View
I want to validate customer input for ph# for eg in format (901) 348 3455. In VB6 we could use a
maskEdit control to format phone nos etc. How do we do that in
.NET. please suggest.
Maybe buliding your own user control that does validation for different formats you pass to it.
validating, oh. I thought u ment formatting. Well, just do the traditional strategies.
The traditional way....VB Code:
Private Function VP(PhoneNo As String) If Instr(PhoneNo, "-") > 1 Then Return False End If If InStr(PhoneNo, "(") > 1 Then Return False End If If Instr(PhoneNo, ")") > 1 Then Return False End If ' I know there are more limitations, but I don't have time to code all of it ;) End Sub
I haven't seen a 'good' .Net way yet, although I would be very suprised if they were not out there. You can still use the old masked input though. You just need to reference it from the COM tab. It is something like MSMASK.OCX .... or not...don't remember that well.
I once used that masked input thing. I cant remember what, but I had problems with that, so I abandoned using it.