Data entry in sequential file in vb6
-
I have a FlexGrid control in which i make data entry and when i click on save command button it saves that data to a sequential file. Now my problem is that in another form, I want the user to edit any cell in the FlexGrid and that entry must replace the corresponding entry in the sequential file. But it is appending in the file, inspite of replacing the value that is edited.
-
I have a FlexGrid control in which i make data entry and when i click on save command button it saves that data to a sequential file. Now my problem is that in another form, I want the user to edit any cell in the FlexGrid and that entry must replace the corresponding entry in the sequential file. But it is appending in the file, inspite of replacing the value that is edited.
Sequential files are tricky: they are called sequential because you cannot change the contents in an aribitrary location in the file. The only solution using sequential files is to 1) create a new temporary file (in Output so you don't accidentally append to an existing file) 2) append the old data into the new file until you reach the point which the changed data 3) write the new data 4) resume appending the remaining data (take care to skip the changed ones before resuming copy) The other solution requires you to use Random Access Files and to devise another way of memorizing the data.
Geek code v 3.12 GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++* Weapons extension: ma- k++ F+2 X
-
Sequential files are tricky: they are called sequential because you cannot change the contents in an aribitrary location in the file. The only solution using sequential files is to 1) create a new temporary file (in Output so you don't accidentally append to an existing file) 2) append the old data into the new file until you reach the point which the changed data 3) write the new data 4) resume appending the remaining data (take care to skip the changed ones before resuming copy) The other solution requires you to use Random Access Files and to devise another way of memorizing the data.
Geek code v 3.12 GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++* Weapons extension: ma- k++ F+2 X
Thanks for the help...