You receive an "Object reference not set to an instance of an object" exception for the DataGrid control in Visual Basic .NET (819346)
The information in this article applies to:
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual C# .NET (2002)
SYMPTOMS When you have a DataGrid control on a Microsoft Windows Form, and you set the DataMember property of the DataGrid to a column with binary
data, you receive the following exception: Object
reference not set to an instance of an object The DataMember property is set to the column,
and the System.NullReferenceException exception is displayed in the DataGrid. Also, when you set the DataMember property to any other value in the list, the DataGrid does not refresh, and the DataGrid displays the exception instead the value that you selected. CAUSEThis issue occurs because
Microsoft Visual Basic .NET does not permit you to set the DataMember property of the DataGrid to a DataColumn that has binary data. Therefore, the DataGrid displays the exception instead of the value that you selected.
The DataGrid displays the exception even after you set the DataMember property to a value that is not a binary data value. The form is not
repainted after you change the DataMember property of the DataGrid. Therefore, the DataGrid displays the exception that it receives when you set the DataMember to a DataColumn that has binary data.STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
This problem was corrected in Microsoft Visual Studio .NET (2003).
REFERENCESFor more information, visit the following MSDN Web site:
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply kbfix kbProperties kbDesigner kbWindowsForms kbDataBinding kbCtrl kbControl KB819346 kbAudDeveloper |
---|
|