Andrew,
Well, VB syntax sometimes throws me for a loop, but try setting up your View's Table when you first instantiate it, something like this:
Dim ExportFilesFinder As New DataView(ExportWorkingData.Tables("ExportFiles"))
Also, I noticed that you're setting two unnecessary properties ... unnecessary because you're setting them to the defaults anyway, so why bother:
.RowFilter = ""
.RowStateFilter = DataViewRowState.CurrentRows
Oh, I forgot to ask ... on which line are you getting the error?
~~Bonnie
>I am developing a winforms application and I am constructing a dataset to handle a complex set of working data required to control the update process.
>
>So I create a new dataset. Then I create table objects, add their columns and promary keys and then add them to the dataset's Tables collection. So far so good.
>
>I then need to create a dataview to interrogate one of the tables. I create the dataview object and set its table property to the table I want. When I try to set the dataview's sort property I get a data exception "DataTable must be set prior to using DataView."
>
>I thought this might be because I have no data in the data table so I added a dummy record to the table before I created the dataview. The relevant code looks like this
>
>
>.ExportFilesFinder = New DataView
>With .ExportFilesFinder
> .Table = Me.ExportWorkingData.Tables("ExportFiles")
> .RowFilter = ""
> .RowStateFilter = DataViewRowState.CurrentRows
> .Sort = "CommentaryPointId asc"
>End With
>
>
>I'm probably doing something basically wrong but help on this error message is hard to come by. Anyone got any thoughts or solutions?
>
>TIA
>
>Andrew