BUG: A check box is not cleared when you call the AddNew method on a DataSet (321504)
The information in this article applies to:
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2002), Academic Edition
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
This article was previously published under Q321504 SYMPTOMS When you call the AddNew method on a DataSet object that is bound to TextBox controls on a form, the text boxes are cleared as expected.
However, if you add a CheckBox control to the binding in the same form, none of the controls are
cleared when you call the AddNew method on the DataSet. RESOLUTION To work around this problem, explicitly set a default value
for the Boolean data column in the .XSD file. For example, assume
that you use the Authors table from the sample Pubs database that is included with Microsoft SQL Server. Also, assume
that the form that you use contains the following items:
- TextBox control that is linked to the authors.au_lname field
- CheckBox control that is linked to the authors.contract field
If you add a Button control that implements the AddNew method, the text box and the check box are not cleared when you
click the button. However, if you explicitly set a default value for
the Boolean data column authors.contract, this problem does not
occur. To explicitly set a default value for the Boolean data column,
use the XML Schema Definition (XSD) designer (in Design view or in Source view)
when you edit the DataSet .xsd file that is generated. To use the XSD designer,
follow these steps: Note These steps assume that you are using the Authors table of the Pubs database.
- In Solution Explorer of Microsoft Visual Basic .NET, view
the XSD DataSet object that is already generated, and then double-click this
object. Notice that the Authors table appears in a graphical representation on your work
area.
- Select the contract (Boolean) element in the graphical
representation of the Authors table.
- In the Properties window, set the default property to false.
Note This value is case-sensitive. If you use "False" for this value,
you will receive a build error message. - Recompile your project, and then test your form. Notice
that the text box and the check box are cleared as expected.
STATUSMicrosoft
has confirmed that this is a problem in the Microsoft products that are listed
at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 8/26/2005 |
---|
Keywords: | kbvs2002sp1sweep kbbug kbpending KB321504 kbAudDeveloper |
---|
|