kh aafi kh aafi - 1 month ago 10
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;

SeM SeM
Answer

This should do the trick

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

it will clear the input box.