-1

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");
4

1 回答 1

1

您使用的是哪个 DatePicker 控件?

这是我的经验,大多数支持一个属性,可能称为 SelectedDate 是可以为空的DateTime?类型。通过将此值设置为 null,它将重置 DatePicker。

如果要重置 .NET DateTimePicker 控件,它的 Value 属性不可为空。有一种解决方法可以清除它,尽管我从未尝试过。这是一个显示解决方法的链接:http: //dotnetref.blogspot.com/2009/03/setting-datetimepicker-to-blank-value.html

于 2012-09-24T19:38:22.830 回答