Click to See Complete Forum and Search --> : more help please....:)


drstrangelove
01-23-2001, 04:02 PM
Ok here goes...
I am new to VB (blah blah blah-you've heard it all before.) i don't want ppl to tell me exactly what to type (unless it is EXTREMELY difficult hehehe) but to point me somewhere to find the answer myself.
I have a file (text file) i need to copy to a new directory and then erase the first line if it doesn't equal "MAKE" (without the quotes) and replace it with "FILE" (also without the quotes) concatenated with a variable.
I have gotten far enough to copy the file. but the OPEN deal is giving me a headache. Open for append adds the new data to the bottom. open for output erases the file before reading it to buffer, and write # adds quotation marks (according to the book I have). I think I know what I need to do, but I am unsure how to go about doing it.
Instead of copying the file and then editing it would it be easier/better for me to open it for input from it's original location and then open it for output at it's new location (my book made it seem that if i did this it would create the file if it didn't already exist.) But after that, I don't know how to do the if stuff to check for the "MAKE" (I guess that's what I need to do).
Any suggestions would be greatly appreciated. Feel free to email me if you want. If this didn't make sense, post a reply or email me for more info.
Thanks
Dr. Strangelove





------------------
Never go up against a Sicilian when death is on the line!!
Hahahahahahaha***

Theologian
01-24-2001, 03:43 AM
I have a file (text file) i need to copy to a new directory and then erase the first line if it doesn't equal "MAKE" (without the quotes) and replace it with "FILE" (also without the quotes) concatenated with a variable.
I have gotten far enough to copy the file. but the OPEN deal is giving me a headache. Open for append adds the new data to the bottom. open for output erases the file before reading it to buffer, and write # adds quotation marks (according to the book I have). I think I know what I need to do, but I am unsure how to go about doing it.
Instead of copying the file and then editing it would it be easier/better for me to open it for input from it's original location and then open it for output at it's new location (my book made it seem that if i did this it would create the file if it didn't already exist.) But after that, I don't know how to do the if stuff to check for the "MAKE" (I guess that's what I need to do).
.
Thanks
Dr. Strangelove
[/B]

I'm no VB expert and I am currently going through some serious problems w/the notebook that I run my MS stuff on so I can't check anything out- but here is what I did a year or so ago when I took a vb class.

You have to use open to read it. On the files I worked with, and these were comma delimited so it may be different- we opened for output, then used Input# to read the file and assign the data to variables. From what you are saying about checking the first line you may want to use Line Input to read that first line.

Set up some kind of case of if statement to create a string w/what you want in the file and then use Print with the character position set so that you insert the new info where you want it.

That seems kind of vague- and I wish I could try it out. I am going to try and have the IT guys at school look over my machine when I am there this week-end. Hopefully they will get me back on my feet

On the 29th I start a new job (my first software position) and I'll be using VB a lot. So I'll always be glad to hash things over-- I'll probably learn more than I help.

Feel free to e-mail me:
ikthus@msn.com