Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop DateTimePicker from showing Todays Date

Everytime when I start my program DateTimePicker automatically shows todays date and time. How can I stop this ? How can I make it blank ?

I have a DOB DateTimePicker. For some users I don't know their DOB so I would like the DateTimePicker to show null or empty field.

like image 255
Failed_Noob Avatar asked Jan 19 '23 21:01

Failed_Noob


1 Answers

Set DateTimePicker.CustomFormat = " " Make sure there is a space. This will show up as a blank space.

I used a DataRowView drv = DBBindingSource(DB). along with a control statement to set null when needed.

if(drv.Row["DOB"] == DBNull.Value)
{
  DateTimePicker.CustomFormat = " ";
}
else
{
  DateTimePicker.CustomFormat = "dd MMMM yyyy";
}
like image 51
seeSharper Avatar answered Jan 31 '23 02:01

seeSharper