>I am a beginner at Visual Basic. I've having problem with a text box formatting a date how I want it to. I want the date in the format mm/dd/yyyy. I go into the properties of the textbox and set the DataFormat field to that date format. The following code example will not use the format of the text box.
>
>
>myDate = #4/5/2001#
>Text1.Text = myDate
>
>
>The above code displays the date in the textbox as m/d/yy instead of the 4 digit year i want to show.
>
>The following is working for now but i think there should be a better way.
>
>
>myDate = #4/5/2001#
>Text1.Text = Format(myDate,"mm/dd/yyyy")
>
The DataFormat property is only to format the display (not the input) of bound (to a database using DataSource and DataField properties) fields.
Consider using the DateTimePicker control for date input.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com