kh aafi kh aafi - 9 months ago 84
C# Question

Clear the DateTimePicker control in c# winfoms

I want to clear the DateTimePicker control value when i click on clear button but i can't do that with simple double qoutes, So please help me

tbAddress.Text = "";
dtpBirth.Value = "";
cBoxGender.SelectedIndex = -1;

Answer Source

This should do the trick

dtpBirth.CustomFormat = " ";
dtpBirth.Format = DateTimePickerFormat.Custom;

it will clear the input box.