|
-
Oct 31st, 2010, 01:37 PM
#1
Thread Starter
Hyperactive Member
Datagridview with lots of rows
Hi,
I'm working on a project which uses a datagridview to show some data.
The data is loaded from a xml file (which the code parse the xml, and create datagridview cell dynamically). and the user is allowed to change the data, when the program exists, it will write back to the xml file to save the change.
It works fine when there are not many rows. when it has too many rows, say, 10K rows, the program loads slowly.
I searched, found some suggestions, but it seems they do not work very well.
1) when load the data, not create the rows directly. instead, create a datatable, then add the table to the datagridview's data source. it still takes time for the dgv to show the data.
2) then, I guess maybe I should paging the dgv. then it comes 2 questions:
2.a) I only have a manually created table, how can I get a dataadapter/dataset from it? do I have to put data in a database table first (i.e. sql express), then load it to data adapter? is it possible to manually create a data adapter/dataset?
2.b) if I paging the dgv, does it mean I still need manually update the dataset/datatable to keep the possible change when the user navigate through the dgv? or, I can simply use an update method?
The paging method I mentioned is at here: http://www.vb-tips.com/PageDataGridView.aspx
Right now, the solution I have is: since I have the table already, I'll use paging method for the table directly. at the load event, load all data to a global table first, then for a page, clone the table, and only add rows in that page to the clone table, then set the dgv's source as the cloned table. this way, the dgv only holds the rows in that page, if changes happened, then update the global table.
or, I should use a database for this, i.e. sql express? any other suggestions?
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|