1.

Solve : VB6 Text files?

Answer»

I need to WRITE a vb script that will extract a string from a text file. The only problem is that I'm having trouble LOADING the text file. I can get the string easily enough with len() and mid() statements, but how the *censored* do you load or open a text file inside runtime?USE the Open dialog control.you need to use the open command.

Here are a couple examples:

open file, read 1st line into variable "data"
Code: [Select]
Open (App.Path & "\filename.txt") For Input As #1
Line Input #1, Data
Close #1
msgbox data


Open file, run through the file doing something to each line:
Code: [Select]
Open (App.Path & "\filename.txt") For Input As #2
Do Until EOF(2)
Line Input #2, grpfor
msgbox grpfor
Loop
Close #2



Discussion

No Comment Found