It appears you are binding to the underlying table, not the dataview itself,
therefore navigation between the rows will of course be in the order of the
table (not the view).
Try this instead:-
Me.txtName.Text = myDataView(nRecord).Item(0).ToString()
Peter
--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com |
www.opennetcf.org
"Sarah Smith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> hello,
>
> I am using the DataView object to sort records from a dataset.
>
> I use this code to read from the dataview to 2 text boxes on screen:
>
> Me.txtName.Text = myDataView.Table.Rows(nRecord).Item(0).ToString
>
> Me.txtTEL.Text = myDataView.Table.Rows(nRecord).Item(1).ToString
>
>
>
> nRecord is updated by navigation buttons. The columns referenced in
> Item(0) and Item(1) are "Name" and "Tel"
>
> After creating the DataView, I sort the data using myDataView.Sort =
> "Name ASC" or myDataView.Sort = "Name, Tel ASC"
>
> When I use the navigation buttons, the records still appear in the
> same order that they were added to the underlying DataSet. (Not
> sorted).
>
> But .... if I attach a Data grid to the DataView, then the records
> appear sorted and correct.
>
> I've also tried like this:
> Me.txtName.Text =
> myDataView.Table.DefaultView.Item(nRecord).Row.Item(0).ToString()
> Me.txtTEL.Text =
> myDataView.Table.DefaultView.Item(nRecord).Row.Item(1).ToString()
>
>
> Can anyone see something obvious I'm doing wrong?
>
> SS.
>
>
>