WingYip
asked on
format date in text box control
I have a form with an underlying dataset (from a sql server db) that is bound to various textboxes. A couple of the fields in the dataset contain dates. Is there a way to format the dates in the text boxes.
Currently they display as ‘06/10/2003 00:00:00’
I need them to display as 06/10/2003.
Is this possible?
Currently they display as ‘06/10/2003 00:00:00’
I need them to display as 06/10/2003.
Is this possible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsBindingClassFormatTopic.asp
http://www.dotnet247.com/247reference/msgs/32/161476.aspx
http://www.dotnet247.com/247reference/msgs/23/118569.aspx
http://www.dotnet247.com/247reference/System/Windows/Forms/ConvertEventArgs.aspx?v=2
http://www.dotnet247.com/247reference/msgs/32/161476.aspx
http://www.dotnet247.com/247reference/msgs/23/118569.aspx
http://www.dotnet247.com/247reference/System/Windows/Forms/ConvertEventArgs.aspx?v=2
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:
Split: ob2 {http:#9763177} & the-edge {http:#9763248}
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
TheLearnedOne
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Split: ob2 {http:#9763177} & the-edge {http:#9763248}
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
TheLearnedOne
EE Cleanup Volunteer
ASKER
Have just tested the code.
the-edge gets the points
Thanks
Wing
the-edge gets the points
Thanks
Wing
1) TextBox.Text = String.Format("{0:d}", Date)
Where d is always lowercase for short date and where date is the date from your dataset.