---
title: "DateTimePicker Control in VB.Net"  
description: "A DateTimePicker control allows you to select a date and time."  
author: "Pushpendra Singh"  
published: 2010-12-14  
updated: 2020-04-09  
canonical: https://www.mindstick.com/articles/295/datetimepicker-control-in-vb-dot-net  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 2 minutes  

---

# DateTimePicker Control in VB.Net

A [DateTimePicker control](https://www.mindstick.com/forum/328/how-get-date-in-c-sharp-datetimepicker-control) allows you to [select](https://www.mindstick.com/forum/34066/use-select-operator-in-linq) a date and time.\

[Drag and drop](https://www.mindstick.com/forum/454/how-to-drag-and-drop-multiple-image-from-one-canvas-to-onther-canvas-in-html5) DateTimePicker control form toolbox on [window Form](https://www.mindstick.com/forum/527/how-to-pass-datagridview-s-cells-value-to-another-window-form).

![DateTimePicker Control in VB.Net](https://www.mindstick.com/mindstickarticle/bccb2362-5980-408d-aae6-56bb67a9c7d4/images/abd9edad-4c61-4d40-9b6f-5b5e771ad364.png)

## Code:

```
' DateTimePicker ValueChanged Event HanderPrivate Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e  As System.EventArgs) Handles DateTimePicker1.ValueChanged         'Display the selected Date in Label         Label2.Text = DateTimePicker1.Text      End Sub
```

**Run the [project](https://yourviews.mindstick.com/story/1788/things-to-ensure-your-construction-project-is-successful)**

![DateTimePicker Control in VB.Net](https://www.mindstick.com/mindstickarticle/bccb2362-5980-408d-aae6-56bb67a9c7d4/images/b2fddbf2-9e4d-452f-bf9a-a8b64aa151da.png)

When you click on the [calendar](https://www.mindstick.com/articles/13088/how-to-choose-the-best-calendar-for-you-dynamics-crm-system) icon in the control then calendar popup will show.

![DateTimePicker Control in VB.Net](https://www.mindstick.com/mindstickarticle/bccb2362-5980-408d-aae6-56bb67a9c7d4/images/1f786381-9f2d-4c51-b72f-d0beba701ead.png)

When you select the date then ValueChanged event will fire and selected date will be show in Label.

![DateTimePicker Control in VB.Net](https://www.mindstick.com/mindstickarticle/bccb2362-5980-408d-aae6-56bb67a9c7d4/images/1a39a067-db2f-4453-869a-f8a514dc16e1.png)

**DateTimePicker [Properties](https://yourviews.mindstick.com/view/81845/now-it-s-possible-to-predict-properties-of-any-molecule):**

**Format:** we can set DateTimePicker Format in which Format it should show.

```
  Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         'Display the date in Short Format         DateTimePicker1.Format = DateTimePickerFormat.Short    End Sub
```

At run time DateTimePicker value will show in short Format.

![DateTimePicker Control in VB.Net](https://www.mindstick.com/mindstickarticle/bccb2362-5980-408d-aae6-56bb67a9c7d4/images/de81225f-0144-4cff-b450-372afb01986a.png)

**Show [checkbox](https://www.mindstick.com/articles/291/how-should-use-checkbox-control-in-vb-dot-net):**

You can make a DateTimePicker control editable where you can change the value without using the Calendar. This can be done by setting ShowCheckBox [property](https://www.mindstick.com/articles/198559/an-ownership-of-property-in-hua-hin) to true.

```
     Private Sub Form2_Load(ByVal sender  As System.Object, ByVal e As System.EventArgs)  Handles MyBase.Load         ' Makes DateTimePicker editable         DateTimePicker1.ShowCheckBox = True        End Sub
```

\

![DateTimePicker Control in VB.Net](https://www.mindstick.com/mindstickarticle/bccb2362-5980-408d-aae6-56bb67a9c7d4/images/49f6d05b-0a99-4279-9001-f167c411431b.png)

Checkbox will show in DateTimePicker.You can edit the value in DateTimePicker and changed value will show in Label.

## ShowUpDown

We can also use an up-down control to set the date and time.

```
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load                 'UpDown control will show in DateTimePicker          DateTimePicker1.ShowUpDown = True    End Sub
```

\

![DateTimePicker Control in VB.Net](https://www.mindstick.com/mindstickarticle/bccb2362-5980-408d-aae6-56bb67a9c7d4/images/dd22f010-bf16-48dd-ba38-44c500ba1b68.png)

UpDown Control is display in DateTimePicker.we can change date through Updown.

---

Original Source: https://www.mindstick.com/articles/295/datetimepicker-control-in-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
