How to stop Date/Time field from showing TIME

Posted on 2004-11-15
Last Modified: 2010-04-23
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 can I make it stop :P
Question by:Matrix1000
    LVL 8

    Accepted Solution

    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
    LVL 1

    Author Comment

    Works Great Thanks!
    LVL 8

    Expert Comment

    you're welcome

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now