Display current time and Data time control : Date Time Picker « GUI « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » Date Time PickerScreenshots 
Display current time and Data time control
Display current time and Data time control

Imports System.Windows.Forms


Public Class MainClass

    Public Shared Sub Main()
      Application.Run(New Form1)
    End Sub

End Class


Public Class Form1
   Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

   Public Sub New()
      MyBase.New()

      'This call is required by the Windows Form Designer.
      InitializeComponent()

      'Add any initialization after the InitializeComponent() call

   End Sub

   'Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
      If disposing Then
         If Not (components Is NothingThen
            components.Dispose()
         End If
      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.
   Friend WithEvents lblCurrentTimeIs As System.Windows.Forms.Label
   Friend WithEvents lblCurrentTime As System.Windows.Forms.Label
   Friend WithEvents fraDeliveryTime As System.Windows.Forms.GroupBox
   Friend WithEvents lblDeliveryTime As System.Windows.Forms.Label
   Friend WithEvents lblLasVegasTime As System.Windows.Forms.Label
   Friend WithEvents fraDropOff As System.Windows.Forms.GroupBox
   Friend WithEvents dtpDropOff As System.Windows.Forms.DateTimePicker
   Friend WithEvents tmrClock As System.Windows.Forms.Timer
   Friend WithEvents lblDropOff As System.Windows.Forms.Label
   <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
      Me.components = New System.ComponentModel.Container
      Me.lblCurrentTimeIs = New System.Windows.Forms.Label
      Me.lblCurrentTime = New System.Windows.Forms.Label
      Me.fraDeliveryTime = New System.Windows.Forms.GroupBox
      Me.lblLasVegasTime = New System.Windows.Forms.Label
      Me.lblDeliveryTime = New System.Windows.Forms.Label
      Me.fraDropOff = New System.Windows.Forms.GroupBox
      Me.dtpDropOff = New System.Windows.Forms.DateTimePicker
      Me.lblDropOff = New System.Windows.Forms.Label
      Me.tmrClock = New System.Windows.Forms.Timer(Me.components)
      Me.fraDeliveryTime.SuspendLayout()
      Me.fraDropOff.SuspendLayout()
      Me.SuspendLayout()
      '
      'lblCurrentTimeIs
      '
      Me.lblCurrentTimeIs.Location = New System.Drawing.Point(16016)
      Me.lblCurrentTimeIs.Name = "lblCurrentTimeIs"
      Me.lblCurrentTimeIs.TabIndex = 0
      Me.lblCurrentTimeIs.Text = "Current time is:"
      Me.lblCurrentTimeIs.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
      '
      'lblCurrentTime
      '
      Me.lblCurrentTime.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
      Me.lblCurrentTime.Location = New System.Drawing.Point(24816)
      Me.lblCurrentTime.Name = "lblCurrentTime"
      Me.lblCurrentTime.Size = New System.Drawing.Size(9623)
      Me.lblCurrentTime.TabIndex = 1
      Me.lblCurrentTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
      '
      'fraDeliveryTime
      '
      Me.fraDeliveryTime.Controls.Add(Me.lblLasVegasTime)
      Me.fraDeliveryTime.Controls.Add(Me.lblDeliveryTime)
      Me.fraDeliveryTime.Location = New System.Drawing.Point(16136)
      Me.fraDeliveryTime.Name = "fraDeliveryTime"
      Me.fraDeliveryTime.Size = New System.Drawing.Size(32873)
      Me.fraDeliveryTime.TabIndex = 2
      Me.fraDeliveryTime.TabStop = False
      Me.fraDeliveryTime.Text = "Get Time Date Pick Value"
      '
      'lblLasVegasTime
      '
      Me.lblLasVegasTime.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
      Me.lblLasVegasTime.Location = New System.Drawing.Point(9632)
      Me.lblLasVegasTime.Name = "lblLasVegasTime"
      Me.lblLasVegasTime.Size = New System.Drawing.Size(22424)
      Me.lblLasVegasTime.TabIndex = 1
      Me.lblLasVegasTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
      '
      'lblDeliveryTime
      '
      Me.lblDeliveryTime.Location = New System.Drawing.Point(1332)
      Me.lblDeliveryTime.Name = "lblDeliveryTime"
      Me.lblDeliveryTime.Size = New System.Drawing.Size(8023)
      Me.lblDeliveryTime.TabIndex = 0
      Me.lblDeliveryTime.Text = "Delivery time:"
      Me.lblDeliveryTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
      '
      'fraDropOff
      '
      Me.fraDropOff.Controls.Add(Me.dtpDropOff)
      Me.fraDropOff.Controls.Add(Me.lblDropOff)
      Me.fraDropOff.Location = New System.Drawing.Point(1656)
      Me.fraDropOff.Name = "fraDropOff"
      Me.fraDropOff.Size = New System.Drawing.Size(32864)
      Me.fraDropOff.TabIndex = 3
      Me.fraDropOff.TabStop = False
      Me.fraDropOff.Text = "Drop Off"
      '
      'dtpDropOff
      '
      Me.dtpDropOff.CustomFormat = "hh:mm tt"
      Me.dtpDropOff.Format = System.Windows.Forms.DateTimePickerFormat.Custom
      Me.dtpDropOff.Location = New System.Drawing.Point(15232)
      Me.dtpDropOff.Name = "dtpDropOff"
      Me.dtpDropOff.ShowUpDown = True
      Me.dtpDropOff.Size = New System.Drawing.Size(8821)
      Me.dtpDropOff.TabIndex = 1
      '
      'lblDropOff
      '
      Me.lblDropOff.Location = New System.Drawing.Point(4032)
      Me.lblDropOff.Name = "lblDropOff"
      Me.lblDropOff.Size = New System.Drawing.Size(10421)
      Me.lblDropOff.TabIndex = 0
      Me.lblDropOff.Text = "Enter time:"
      Me.lblDropOff.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
      '
      'tmrClock
      '
      Me.tmrClock.Enabled = True
      Me.tmrClock.Interval = 1000
      '
      'FrmShippingTime
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(514)
      Me.ClientSize = New System.Drawing.Size(360229)
      Me.Controls.Add(Me.fraDropOff)
      Me.Controls.Add(Me.fraDeliveryTime)
      Me.Controls.Add(Me.lblCurrentTime)
      Me.Controls.Add(Me.lblCurrentTimeIs)
      Me.Font = New System.Drawing.Font("Tahoma"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
      Me.Name = "Time"
      Me.Text = "Time"
      Me.fraDeliveryTime.ResumeLayout(False)
      Me.fraDropOff.ResumeLayout(False)
      Me.ResumeLayout(False)

   End Sub

#End Region

   Private Sub tmrClock_Tick(ByVal sender As System.Object, _
      ByVal e As System.EventArgsHandles tmrClock.Tick

      lblCurrentTime.Text = String.Format("{0:hh:mm:ss tt}", _
         Date.Now)

   End Sub

   Private Sub FrmShippingTime_Load(ByVal sender As System.Object, ByVal e As System.EventArgsHandles _
      MyBase.Load

      DisplayDeliveryTime()

   End Sub 

   Private Sub dtpDropOff_ValueChanged(ByVal sender As _
      System.Object, ByVal e As System.EventArgsHandles _
      dtpDropOff.ValueChanged

      DisplayDeliveryTime()

   End Sub 

   Sub DisplayDeliveryTime()

      lblLasVegasTime.Text = dtpDropOff.Value

   End Sub 
End Class 
           
       
Related examples in the same category
1.Date Time Picker Demo
2.Date Time Picker: get selection rangeDate Time Picker: get selection range
w__w___w__.__j_ava2___s_.__c_o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.