DateTimePicker Control

The DateTimePicker control allows you to display and collect date and time from the user with a specified format.

The DateTimePicker control prompts the user for a date or time using a graphical calendar with scroll arrows. The most important property of the DateTimePicker is the Value property, which holds the selected date and time.

The Value property is set to the current date by default. You can use the Text property or the appropriate

member of Value to get the date and time value.

The control can display one of several styles, depending on its property values. The values can be displayed in four

formats, which are set by the Format property: Long, Short, Time, or Custom.

The following VB.Net program shows how to set and get the value of a DateTimePicker1 control.

Public Class Form1

	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		DateTimePicker1.Format = DateTimePickerFormat.Short
		DateTimePicker1.Value = "12/31/2010"
	End Sub

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim idate As String
		idate = DateTimePicker1.Value
		MsgBox("Selected date is  : " & idate)
	End Sub

End Class (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About