Click here to Skip to main content
15,893,668 members
Articles / Programming Languages / Visual Basic

Composite Date & Time Control

Rate me:
Please Sign up or sign in to vote.
4.40/5 (13 votes)
11 Apr 2007CPOL2 min read 69.4K   1.6K   18  
A control showing both date and time
Public Class Form1

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        CompositeDateTimeControl1.DateTimeValue = New Date(0L)
    End Sub

    Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGet.Click
        txtDate.Text = CompositeDateTimeControl1.DateTimeValue.ToString("dd-MMM-yyyy hh:mm tt")
    End Sub

    Private Sub btnSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSet.Click
        Date.TryParse(txtDate.Text, CompositeDateTimeControl1.DateTimeValue)
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
I have been developing applications at City of Moncton since 1992. My focus is on C# forms and web development, along with DB design.

Comments and Discussions