Datagrid not displaying all rows
Posted on 2012-03-29
I am using VS 2008, SQL CE and VB.
I have a DataGrid that is bound to via a recordset.
When I update the data source for the DataGrid, data in the DataGrid's visible rows are displayed correctly. However if you scroll down, the cells below are blank with a big "X". When you scroll back up, the rows that were displaying data are now replaced with big "X".
Here's the code:
Me.MyDataGrid.Doc = DockStyle.Bottom
Dim cmd as New SqlCECommand()
Dim conn as New SqlCEConnection()
Dim rs as SqlCEResultSet
conn.ConnectString ="Data Source = '\data.sdf'; mode=Exclusive;"
cmd.CommandText = "SELECT * FROM table1"
rs = cmdExecuteResultSet(ResultSetOptions.Scrollable or ResultSetOptions.Updatable)
if rs.HasRows then
Me.MyDataGrid.DataSource = rs
rs = Nothing
How do I display all the rows and make the scroll bar work?