Hi Roland,
You want to make sure you are using the DataBinding methods of the DataGrid. After you retrieve the contents of the DataSet (and you have records retrieved), you should call the SetDataBinding method of the DataGrid like below:
this.BindingContext[this.MyDataSet, "MyDataTable"].Position = 0;
if (MyDataSet.Tables["MyDataTable"].Rows.Count > 0)
{
this.grdOrders.SetDataBinding(MyDataSet, MyDataTable);
}
else
{
this.grdOrders.DataBindings.Clear();
}
If you have Kevin McNeish's .NET book, in chapter 9 he discusses binding techniques and the sample application uses the above databinding.
>Hi,
>
>I have an windows forms app in VB.net using SqlConn/SqlDa/Datasets generated by the wizards.
>
>The first thing that I do is have the user enter in a search field and then clear and fill the dataset using parameters. The grid shows the desired rows. OK so far, but the second search (clear / fill) produces a dataset with the row pointer pointing at a different row then the first row of the grid.
>
>How do I position the row pointer to point to the first row of the newly genrated grid / dataset instead of randomly pointing to other than the first row?
>
>Thanks
>Roland
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi