vb.net datetimepicker initialized to NULL, select to display the date

Source: Internet
Author: User

Purpose: When the date data for a record is empty, the DateTimePicker is not displayed at the default current time.

Advantages: Avoid irregular time format input, and meet the usual time input habits

Cons: Set to Code, no TextBox controls so easy to set up

Steps:

1. Insert Control DateTimePicker

2. In the A form ( target form ) Load event, or B form to open a form, fill in the following statement (I'm here to open a form with B form)

            DimFrmsampleorder as Newfrmsampleorder frmsampleorder.show ()IfDatagridview1.rows (E.rowindex). Cells ("Scheduled ship Date"). Value.ToString.Trim =""  ThenFrmSampleOrder.txt planned date of shipment. Format=Datetimepickerformat.custom frmSampleOrder.txt planned date of shipment. CustomFormat=" "            ElseFrmSampleOrder.txt planned date of shipment. Text= Datagridview1.rows (E.rowindex). Cells ("Scheduled ship Date"). Value.ToString.TrimEnd If

3. In the Open a form, select the DateTimePicker control and select the ValueChanged event to insert the following code

    Private Sub  as Object  as Handles txt scheduled shipping date. valuechanged        = datetimepickerformat.short    End Sub

4, save.

This completes the usual habit of a date selection control

vb.net datetimepicker initialized to NULL, select to display the date

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.