[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

How to stop Date/Time field from showing TIME

I have an access database with a Date/Time field.
When I bind a label to this field it shows the date thats in the field....but then it shows "12:00:00 AM"....I didn't put that in there...how can I make it stop :P
0
Matrix1000
Asked:
Matrix1000
  • 2
1 Solution
 
wguerramCommented:
Add this code in the constructor of the form

public sub new
  AddHandler label1.DataBindings("Text").Format, AddressOf DateToString
end sub


 ' Handles the Format event for the date
Protected Sub DateToString(ByVal sender As Object, ByVal e As ConvertEventArgs)
        ' You could use either of the following to convert to the proper date
        ' format:
        'e.Value = CType(e.Value, DateTime).ToString("mm/dd/yyyy")
        e.Value = CType(e.Value, DateTime).ToShortDateString
    End Sub
0
 
Matrix1000Author Commented:
Works Great Thanks!
0
 
wguerramCommented:
you're welcome
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now