i’m new to using C# and .NET and SQL Server…i’m doing a form design to allow a staff member to register a customer’s details to a database. in the form i have the method to extract the data from the fields in the form, as well as a date picker to enter a customer’s date of birth, however i am finding a bit of trouble to enter the format and default data type as i am unsure of how i am to go about doing this…the code for my form is shown below…”dobTP” is the name of my date picker box:
SAF.AddNewCustomer(CustomerFirstName, CustomerLastName, CustomerContactNumber, dobTP, CustomerUsername, CustomerPassword, CustomerAddress, CustomerLicense, CustomerCreditCard);
txtCustomerFirst.Text = "";
txtCustomerLast.Text = "";
txtCustomerContact.Text = "";
dobTP ??
txtCustomerUsername.Text = "";
txtCustomerPassword.Text = "";
txtCustomerAddress.Text = "";
txtCustomerLicense.Text = "";
txtCustomerCredit.Text = "";
MessageBox.Show("Customer Created");
Which DatePicker control are you using?
It’s been my experience, most support a property, probably called SelectedDate that is of nullable DateTime? type. By setting this value to null, it will reset the DatePicker.
If you want to reset the .NET DateTimePicker control, it’s Value property is not nullable. There is a workaround to clear it, although I’ve never tried it. Here is a link showing the workaround: http://dotnetref.blogspot.com/2009/03/setting-datetimepicker-to-blank-value.html.