How to remove the time portion from a texbox

  • Thread starter Thread starter vanvee
  • Start date Start date
V

vanvee

Hi

I have textbox in VB.Net that is bound to a Date/Time field in an
Access database. The date in Access database only has the date and no
time. When you load the dataset into the VB.Net application though,
12:00 time shows up. I realize this is the default but time is
meaningless to our application and makes it look bad.

Can anyone please let me know if there is a way to format a text box
bound to a date field so that is automatically doesn't show the time
part of the date.

I saw a post or two about formatting using substring, but what event
could be used to call this? I know this is a workaround, but is
there a property to just display the date?? There must be an easier
way!!

Any help would be greatly apprecitated!!
 
You can try encapsulating the FormatDateTime function around your textbox to
return what you need or convert the textbox to show a string format of the
data, such as String.Format("{0:MM/\dd\/yyyy}", fieldname). The exact syntax
depends on how you are returning the data to the textbox.
 
Back
Top