Snapshot of current datagridview and tableadapter

ballybeg

Member
Joined
Jul 28, 2011
Messages
20
Location
Canberra Australia
Programming Experience
10+
Hi all.

After searching around I have not found what imagine is a simple solution to a problem I am having.

I have a DGV based on a DS, with a BindingSource and TableAdapter set to an Access backend.

I have the DGV sorted the way I want - now I have written a sub that applies a parameterised query to the TAdapter to filter the whole list so I can do a count on certain data in the table.

At the end of the sub I want the DGV (and the TA that I have filtered) to go back 'the way it was'. There are several filters that can be applied to the the DGV so I cant simply requery the TA unless I know what query it was based upon - Im sure the current "view" can be passed as a parameter so I can restore it

I thought of copying the current TA and to a new instance of a TA and applying the filter and count on that, but the filter still updates the DGV.

My question is - is there a way pass the current query as a parameter, apply the filter to the TA and then revert to the pre filtered TA query as per the parameter?

here is the filter I apply

VB.NET:
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] Form1.TblRaceListTableAdapter.FillByTrackandType(Form1.ToteBetterDataSet.tblRaceList, strTrack, strType)
[/SIZE][/FONT][/SIZE][/FONT]
2nd question is my strategy the optimum one, there is usually a better way....

Thanks in advance - ballybeg
 
Hi ballybeg,

I'm not sure but maybe this could help.

--> Dim dt as new Form1.ToteBetterDataset.tblRacelist

and then Apply the Filter to 'dt' instead.

--> Form1.TblRaceListTableAdapter.FillByTrackandType(dt, strTrack, strType)

Gunze
 
Back
Top