Text box date/time format

dimeanel

Member
Joined
Apr 12, 2006
Messages
7
Programming Experience
Beginner
I what to format text box to receive only date not numbers or characters. What should I do on widows form text box properties to do this acton or maybe I have to wright some code about it?
 
I'm not sure, but I think you mean something like this:
VB.NET:
dim dteDatum as date
dteDatum = cDate(textbox1.text)
With this the text from the textbox is converted to a date.
 
CDate may not be a good solution because of the exact format requirements, I would rather go for Date.Parse method:
VB.NET:
Dim dt As Date = Date.Parse(textbox1.Text)
 
Back
Top