Much better. Thanks.
You can save values in the Registry, which is pretty nice to use.
(I always feel more important when I use the Registry...)
To save the value use
SaveSetting App.Title, "<SectionHere>", "<EntryInSection>", <Value>
App.Title could be a different string, if you want to do that.
So you would use like
SaveSetting App.Title, "UserPrefs", "FilePath", form2.txtPath.Text
To retrieve the value, use
<VariableHere> = GetSetting(App.Title, "<SectionHere>", "<EntryInSection>", <defaultValue>)
form2.txtPath.Text = GetSetting(App.Title, "UserPrefs", "FilePath", "")
A second way would be to just write it out to a file. I really like using the Windows Scripting Runtime, because it is so easy.
Add a reference to your project for "Microsoft Scripting Runtime," (scrun.dll, in systen32 on my machine).
Declare a variable (I like fso):
Dim fso As FileSystemObject
Dim ts As TextStream
Set ts = fso.OpenTextFile("FileName", ForAppending [or ForWriting], <Create T/F>, TristateUseDefault)
Set ts = fso.OpenTextFile("FileName", ForReading, False, TristateUseDefault)
form2.txtPath.Text = ts.ReadLine
Set fso = Nothing
That should do it...
Using the Registry method allows you to easily store several different things (using a different section/item combination), which then can be easily retrieved individually. If you use the writing-to-a-file method, you will have to devise a way to keep things separate if you store more than 1 item.