Click here to Skip to main content
15,885,910 members
Articles / Programming Languages / Visual Basic

Yet Another Date/Time Picker

Rate me:
Please Sign up or sign in to vote.
2.50/5 (3 votes)
26 Oct 2009CPOL5 min read 37.7K   1.3K   11  
An article on yet another date/time picker
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ctlDateTime
    Inherits System.Windows.Forms.UserControl

    'UserControl overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.txtTime = New System.Windows.Forms.MaskedTextBox
        Me.txtLongDate = New System.Windows.Forms.TextBox
        Me.txtDate = New System.Windows.Forms.MaskedTextBox
        Me.dtp = New System.Windows.Forms.DateTimePicker
        Me.SuspendLayout()
        '
        'txtTime
        '
        Me.txtTime.Location = New System.Drawing.Point(289, 1)
        Me.txtTime.Mask = "00:00:00"
        Me.txtTime.Name = "txtTime"
        Me.txtTime.Size = New System.Drawing.Size(48, 20)
        Me.txtTime.TabIndex = 2
        '
        'txtLongDate
        '
        Me.txtLongDate.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtLongDate.Location = New System.Drawing.Point(1, 1)
        Me.txtLongDate.Name = "txtLongDate"
        Me.txtLongDate.ReadOnly = True
        Me.txtLongDate.Size = New System.Drawing.Size(198, 20)
        Me.txtLongDate.TabIndex = 3
        Me.txtLongDate.TabStop = False
        '
        'txtDate
        '
        Me.txtDate.BackColor = System.Drawing.SystemColors.Window
        Me.txtDate.Location = New System.Drawing.Point(201, 1)
        Me.txtDate.Mask = "00/00/0000"
        Me.txtDate.Name = "txtDate"
        Me.txtDate.Size = New System.Drawing.Size(65, 20)
        Me.txtDate.TabIndex = 0
        Me.txtDate.ValidatingType = GetType(Date)
        '
        'dtp
        '
        Me.dtp.CustomFormat = "MM/dd/yyyy HH:mm:ss"
        Me.dtp.Format = System.Windows.Forms.DateTimePickerFormat.Custom
        Me.dtp.Location = New System.Drawing.Point(268, 1)
        Me.dtp.MaxDate = New Date(2030, 12, 31, 0, 0, 0, 0)
        Me.dtp.MinDate = New Date(1890, 1, 1, 0, 0, 0, 0)
        Me.dtp.Name = "dtp"
        Me.dtp.Size = New System.Drawing.Size(19, 20)
        Me.dtp.TabIndex = 1
        Me.dtp.TabStop = False
        '
        'ctlDateTime
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Controls.Add(Me.dtp)
        Me.Controls.Add(Me.txtLongDate)
        Me.Controls.Add(Me.txtTime)
        Me.Controls.Add(Me.txtDate)
        Me.MaximumSize = New System.Drawing.Size(341, 26)
        Me.MinimumSize = New System.Drawing.Size(341, 26)
        Me.Name = "ctlDateTime"
        Me.Size = New System.Drawing.Size(337, 22)
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents txtDate As System.Windows.Forms.MaskedTextBox
    Friend WithEvents txtTime As System.Windows.Forms.MaskedTextBox
    Friend WithEvents txtLongDate As System.Windows.Forms.TextBox
    Friend WithEvents dtp As System.Windows.Forms.DateTimePicker

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
Code 3 Systems, Inc.
United States United States
Bryan is a senior developer with Code 3 Systems, Inc. He has been coding in VB.NET for the last 4 years using Visual Studio 2005 and 2008. His IT career has spanned over 40 years doing work from computer operation to programming and management.

Comments and Discussions