CustomValidator control to validate a date in format dd/mm/yyyy

E

EmJayEm

Does anyone have the vb.net code which uses a customvalidator control to
validate a date in the format dd/mm/yyyy

Thanks,

EmJ.
 
E

EmJayEm

Peter Blum said:
There are several solutions:

1. You don't need to use a CustomValidator. The CompareValidator does it.
Set its Operator to DataTypeCheck and Type=Date. Make sure the current
thread has a CultureInfo object that reflects your desired
ShortDatePattern. See my comments on this thread:
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=785630


I have tried implementing solution 1 and I get the following error message:

Compiler Error Message: BC30691: 'CultureInfo' is a type in 'Globalization'
and cannot be used as an expression.

Source Error:


Line 38: end if
Line 39:
Line 40: System.Globalization.CultureInfo vCulture =
CType(System.Globalization.CultureInfo.CreateSpecificCulture("en-GG").Clone(),
System.Globalization.CultureInfo)
Line 41: vCulture.DateTimeFormat.ShortDatePattern =
"dd/MM/yyyy"
Line 42:
System.Threading.Thread.CurrentThread.CurrentUICulture = vCulture


I have added the namespace system.globalisation

Can you help?

EmJ.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top