Microsoft KB Archive/252756

= PRB: Changing DataGrid Layout Causes DataGrid to Display Empty =

Article ID: 252756

Article Last Modified on 8/23/2001

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q252756



SYMPTOMS
Changing any of the layout properties of the ADO DataGrid Control at design time may cause the grid to not appear properly at run time. Instead of showing the correct data, the grid will appear with two columns and the correct number of rows and the cells that appear will be empty.

This also occurs when changing the number of splits at design time.



RESOLUTION
To resolve this problem, after editing the DataGrid Control, right click it and select Clear Fields or Retrieve Fields. This will allow the DataGrid to show the data in the correct number of columns at run-time.



Steps to Reproduce Behavior
 Create a new Standard EXE in Visual Basic. Click References on the Project menu and select ActiveX Data Objects Library 2.1. Click Components on the Project menu and select Microsoft ADO Data Control 6.0 (OLEDB) and Microsoft DataGrid Control 6.0 (OLEDB). Place an ADO Data Control (Adodc1) on Form1 and set the following properties:

ConnectionString: Enter a valid Northwind connection

CursorLocation: adUseClient

RecordSource: SELECT * FROM Employees

 Place a DataGrid (DataGrid1) on the form and set the following properties:

DataSource: Adodc1

 Right-click DataGrid1 and select Edit from the pop-up menu that appears. Then again right-click DataGrid1 and select Split from the pop-up menu.</li> Run the code. Both splits on the DataGrid will display with two columns and nine rows. The cells will be empty.</li> Quit the application and right-click DataGrid at design time. Select Clear fields from the pop-up menu. Now the data should display correctly at run time.</li></ol>

Keywords: kbdatabinding kbdatabase kbprb kbmdacnosweep KB252756

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.