VB 6.0 How do I read from a .txt file?
-
I am writing an application right now in VB 6.0. I was just wondering if someone could help with this. Upon the FormLoad() function, I need the program to call a notepad file (main.ini) and read the third line and replace a variable inside of my program. Can somebody please please help me???? Thanks again, Bob
-
I am writing an application right now in VB 6.0. I was just wondering if someone could help with this. Upon the FormLoad() function, I need the program to call a notepad file (main.ini) and read the third line and replace a variable inside of my program. Can somebody please please help me???? Thanks again, Bob
Here is a good article that shows you how to do it. You can use this code to do either an ini file or the registry: http://www.thescarms.com/vbasic/registry.asp[^]
-
I am writing an application right now in VB 6.0. I was just wondering if someone could help with this. Upon the FormLoad() function, I need the program to call a notepad file (main.ini) and read the third line and replace a variable inside of my program. Can somebody please please help me???? Thanks again, Bob
ray's ini file reader is the preferred method for working with application config stuff, but if you want to work with text files, use the FileSystemObject where: scrrun.dll, register dialog: Microsoft Scripting Runtime progid: scripting.filesystemobject i'm typing this code in manually, so it might not be syntactful
dim fso as scripting.filesystemobject set fso = new scripting.filesystemobject dim txt as scripting.textstream set txt = fso.opentextfile("c:\mytextfile.txt") do while not txt.atendofstream msgbox txt.readline loop txt.close set txt = nothing set fso = nothing
-John