Formatting dates in a bound control (textbox and datagrid)
OK ... I have looked just about everywhere to find out how to do this.
In VB6 a textbox had a property to set the format of a date when it was bound to a DB. In VB.NET our fearless leaders in Redmond, WA removed that property. I am obviously just slightly frustrated with my inability to figure out how to do it now.
More specifics:
* textbox and datagrid bound to a SQL 2000 DB via a named dataset
* the DB field is a datetime
* by default it shows both a date and time
* only the date is in the DB (the time it shows is 12:00 am for all records)
:confused: :confused: :confused:
please help me ... If I were not already bald I'd be at the point to pull all my hair out. :D
Thanks
formatting dates in bound control
Use format {0:d} in the databinding format section
formatting dates in bound control
Excuse me if I have confused you even more. I am new to VB.net. I am using oledbdataadapter for Oracle database, then I am binding my dataset fields to textbox as well as datagrid.
From datagrid’s ‘property binder’, I am able to format each column entering the expression under ‘data formatting expression’.
Similarly for ‘textbox’, I can do the same under ‘databindings’