Click here to Skip to main content
15,610,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 2 datagridviews

while working both have a very large data about 70,000 + rows with 3 columns in each datagridview

now i have to save both datagridview to a single file with my own extension

so when user simple double clicks a file with my custom extension , my form1 is opened and data is filled to both datagridview again

now i have created such code where i am tacking single rows and writing it to the textfile
it is good for small number of rows but as lines added time is also increased .

for 70,000 lines it tacks about 10 mins , now user can not wait until 10 mins

is there any way to make it fast ?

Assuming you have a DataSet or DataTable associated with the DataGrdiView, you could just use DataSet.WriteXml[^] to write the lot. If each DGV is based on a DataTable, then create a new DataSet, add both tables, and write the DataSet. You can then read it back with DataSet.ReadXml[^] and restore the two tables.
Share this answer
sorry but both datagridviews are unbound

also there is not only datagridview to be saved in file , addition to this 2 datagridview u=i also have to save 2 richtextbox text and some variable values

so what i want is
when user closes application the whole project is saved in a file , so that user can load project file and application must start from where it was last left .
Share this answer
Maciej Los 11-May-13 6:13am    
This is not an answer. Please delete it.
Use "Have a Question or comment" widget instead posting an "answer" or "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900