S
Sarah Smith
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.
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.