By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,727 Members | 768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,727 IT Pros & Developers. It's quick & easy.

Date Formatting Problem

P: n/a

I am binding dates to a textbox, the date is stored in SQL in a datetime
field. When it gets bound it turns it into a long date (Sunday, Dec. 25
2005), in SQL when viewing the table it views as a shortdate. When
inserted to SQL the datetimepicker format for the date is short. I have
not had a problem with the formatting of a date to a textbox before, but
this time I am using the CurrencyManager to navigate though several
records. This is the code it am using to bind it to the textbox:

txtArchiveDate.DataBindings.Add("Text", myDV, "Archive_Date")
Any suggestions on how to fix this date formatting problem would be


*** Sent via Developersdex ***
Dec 26 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Look at creating a Binding object and then adding that to your
Control's DataBindings

'something like this should work
Dim b As New Binding("Text", myDV, "Archive_Date")
'then either
AddHandler b.Format, AddressOf ShortDateToLongDate
b.FormatString = "{0:d}"

Dec 27 '05 #2

P: n/a

This doesn’t work do to the fact that it is a binding and not a string.
Any other ideas
I even tried Changing the SQL to a nvarchar and it still gives me a long

*** Sent via Developersdex ***
Dec 27 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.