|
-
December 18th, 1999, 04:15 AM
#1
Please help.....
Ok, I have this code in my Form_Unload
Call ComboSave
Open Text3.Text for Output as #1
print #1, Form2.Text1.Text
Close #1
Text3.text is just a file name;
ComboSave is a function in module which finds the string in form2.text1.text and replaces it depending on what was in text6 for eg. if text6 ="//Flat 45" then ComboSave would change string in form2.text1.text to "//Flat 45"
Now the problem is that first it writes to a file then it calls ComboSave and changes string to "//Flat 45" in form2.text1.text but I need it to change string in form2.text1.text to "//Flat 45" before it saves to the file so the change would be saved also. Is there anyway to pause writing to file so that ComboSave function can finish the changes in form2.text1.text and after every change had been made, writing to file would start.
Hope that wasn't really confusing, but if it was then please tell me what I should explain detailed, because this procedure is vital to my project.
Thank You
-
December 18th, 1999, 07:18 AM
#2
Re: Please help.....
>"Hope that wasn't really confusing, .."
Well, it was quite a bit.. to be true:-)
Since i couldn't decifer completely, i will answer only parts.
1. Saving in multiple go's:
2 styles: One you can open the file in append mode, write to it and close each time. so the write-file-file code can be places after each and every change.
or Open the file in the begining and pass the file number to the function, and it keeps writing to that.. something like
dim fp as integer
fp = FreeFile()
open text3.Text for Output as fp ' i would prefer using a variable
Call ComboSave(fp) ' now this fn takes an int param
print fp, Form2.text1.Text ' is this form loaded? Otherwise this statement will load it
close fp
sub ComboSave( byval fp as integer)
... do something
print #fp, ... write what eve
...do something else
print #fp,.. write that
..
end sub
I dont know how it is writing to a file, before changing the contents of Text1!.. becasuse file-writing section is after a call to ComboSAve! or is it someother section of code you are refering to.. not presented here.. Also which forms Form_Unload is this?
Anyway, it would probably result in cleaner implementation, if you pass string buffers around, specially to sections where things will be modified and passed back.
RK
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
|