kh aafi kh aafi - 1 year ago 144
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download