I'm trying to get the DirListBox to remember the last folder I openned? Can I do that?
Printable View
I'm trying to get the DirListBox to remember the last folder I openned? Can I do that?
Quote:
Originally posted by DavidH0011
I'm trying to get the DirListBox to remember the last folder I openned? Can I do that?
VB Code:
MsgBox Dir1.dir 'i think
No what I mean is - the next time I open the form with my directory list box I want it already be openned to the last folder I openned.
You can save the last open dir's path to a text file and then open it and retrive the path from the file, then set the DirListBox to that path
Better yet use SaveSetting and Getsetting to save it in the registry.
ya what he said :)
VB Code:
Option Explicit Private Sub Form_Load() GetSetting(App.EXEName, "Options", "Last Dir") = Dir1.Dir End Sub Private Sub Form_Unload(Cancel As Integer) SaveSetting App.EXEName, "Options", "Last Dir", Dir1.Dir End Sub
Moto I do that and I get
Method or data member not found.
Thoughts on how I could trouble shoot it?
GetSetting(App.ImageConverter, "Options", "Last Dir") = Dir1.Dir
Try it the other way around. eg
Where Default_Setting is a string containing a default path in case they haven't saved a setting yet.Code:Dir1.Dir = GetSetting(App.ImageConverter, "Options", "Last Dir", Default_Setting)
Getting close - same error but it is on a different part...
App.ImageConverter
hey you were the one who added App.ImageConverter in Motoxpro code..... jeez......
VB Code:
Option Explicit Private Sub Form_Load() Dir1.Dir = GetSetting(App.EXEName, "Options", "Last Dir") End Sub Private Sub Form_Unload(Cancel As Integer) SaveSetting App.EXEName, "Options", "Last Dir", Dir1.Dir End Sub
oops its not Dir1.Dir its Dir1.Path
VB Code:
Option Explicit Private Sub Form_Load() Dir1.Path= GetSetting(App.EXEName, "Options", "Last Dir") End Sub Private Sub Form_Unload(Cancel As Integer) SaveSetting App.EXEName, "Options", "Last Dir", Dir1.Path End Sub
I dont remember adding my code to anything called Motoprox? I have not touched VB for over a year. Like anything in life you tend to forget things if you do not stay current and practice.
Yea Buggy I figured that one out. I'm not a totall basket case. :D
I just still cant get it to work :(
oops it wasnt you it was the 'But_Why' guy...... and i have no idea why he added that part.
do you have a DirListBox called Dir1?Quote:
Originally posted by DavidH0011
Yea Buggy I figured that one out. I'm not a totall basket case. :D
I just still cant get it to work :(
and maybe try putting
On error resume next
before the GetSetting part.
Yup
and as far as I can see my EXE is called ImageConverter
Hell I wrote the program it has just been soooo long
This is exactly what it looks like
Private Sub Form_Load()
Dir1.Path = "c:\"
Dir1.Path = GetSetting(App.ImageConverter, "Options", "Last Dir")
End Sub
try putting
On error resume next
because if there is not an entry there it will error i think.
Nah same result, the problem continues to be on the ".ImageConverter" in the App.ImageConverter
How can I confirm what my EXE is called?
o my god...........
it doesnt mean replace it with it.
ACTUALLY USE .EXEName
MANANANAMNFMANVGMANDBMNASDBHNBHBKL
not .ImageConverter
GODOGODOGODGODOGODGODOG
sorry. :D
use my EXACT EXACT EXACT code. DONT CHANGE THE APP.EXENAME
VB Code:
Option Explicit Private Sub Form_Load() Dir1.Path= GetSetting(App.EXEName, "Options", "Last Dir") End Sub Private Sub Form_Unload(Cancel As Integer) SaveSetting App.EXEName, "Options", "Last Dir", Dir1.Path End Sub
LMAO jee imagine that it works now. :eek:
Seems like an Honest mistake to me:rolleyes: