开发者

Saving "new data" mixed with "old data" in a DataGridView

I don't need the actual code, but rather, what "strategy" should I use to do something like this:

Somethings I can't change... and must remain as-is:


   1. I have to use vb.net to create my vb.exe executable.
   2. I have to use a standard DataGridView, NOT bound to any datasource.
   3. The text in some columns is obtained from various XML files.
   4. The text in the remaining columns is entered by the user (or left blank).

When he exits the program, I have no problems saving (and later reloading) the entire grid. (I just use a small text file.... or should I be using a SQL database?)

When the user hits my "refresh" button, th开发者_如何学Pythone grid is cleared, and step #3 runs again... but there might be some XML files that have been add or removed. So I "match up" the rows it finds in the refreshed grid, with those "user input cells" that I previously saved to a text file.

Ugh.

I got it to work, but it has to compare 100s of "old rows" to each of 100s of "new rows" and find the "similar rows", and "fill in" the prior user data into certain cells. (Thousands of comparisons.)

Or is their a better way? (The company won't let me change #1-#4, though.)


You could cache the .XML files found in the first time you use step 3, and then after refresh use those files to just read the changed lines, and check how and where they occur in the DataGridView.

Or you could try and speed up the DataGridView behaviour (much to be gained here) to see whether this helps enough to smoothen the program, assuming this is what you're aiming at.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜