[RESOLVED] [02/03] textbox date formatting
hi all,
i'm having problems formatting my textbox at form_load... and as much as possible i want to format it before or right after i bind it to my data table... which ever is possible.
these are the codes i've used but didn't work... i have place it on the Form_Load Event
Code:
txtBirthdate.DataBindings.Add("Text", DT_CUST, "birthdate")
txtBirthdate.Text = Format(txtBirthdate.Text, "dd-MMM-yy")
then i tried this as well but no luck.
Code:
txtBirthdate.DataBindings.Add("Text", DT_CUST, "birthdate")
txtBirthdate.Text = Format(CStr(txtBirthdate.Text), "dd-MMM-yy")
then i tried placing these codes on a button and it worked but it would be inconvenient to push a button just to format a textbox to a date format.
any suggestions? thanks.
Re: [02/03] textbox date formatting
Use a DateTimePicker, not a TextBox.
Re: [02/03] textbox date formatting
ok thanks... this way is much better.
Re: [RESOLVED] [02/03] textbox date formatting
The only drawback is that the DTP doesn't support binding null values. If your column can contain nulls then you either have to forego data-binding or modify the DTP control. The library in my signature contains just such a modified DTP, but only the .NET 2.0 version is available from the link. If you e-mail them I'd guess that they'd supply the .NET 1.1 version for you.