Results 1 to 23 of 23

Thread: Can I get DirListBox to remember?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17

    Can I get DirListBox to remember?

    I'm trying to get the DirListBox to remember the last folder I openned? Can I do that?

  2. #2
    Stiletto
    Guest

    Re: Can I get DirListBox to remember?

    Originally posted by DavidH0011
    I'm trying to get the DirListBox to remember the last folder I openned? Can I do that?
    VB Code:
    1. MsgBox Dir1.dir 'i think

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    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.

  4. #4
    Stiletto
    Guest
    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

  5. #5
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    Better yet use SaveSetting and Getsetting to save it in the registry.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  6. #6
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    ya what he said


    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. GetSetting(App.EXEName, "Options", "Last Dir") = Dir1.Dir
    5. End Sub
    6.  
    7. Private Sub Form_Unload(Cancel As Integer)
    8. SaveSetting App.EXEName, "Options", "Last Dir", Dir1.Dir
    9. End Sub

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    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

  8. #8
    Hyperactive Member
    Join Date
    Jun 2000
    Posts
    299
    Try it the other way around. eg
    Code:
        Dir1.Dir = GetSetting(App.ImageConverter, "Options", "Last Dir", Default_Setting)
    Where Default_Setting is a string containing a default path in case they haven't saved a setting yet.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    Getting close - same error but it is on a different part...

    App.ImageConverter

  10. #10
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    hey you were the one who added App.ImageConverter in Motoxpro code..... jeez......

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. Dir1.Dir = GetSetting(App.EXEName, "Options", "Last Dir")
    5. End Sub
    6.  
    7. Private Sub Form_Unload(Cancel As Integer)
    8. SaveSetting App.EXEName, "Options", "Last Dir", Dir1.Dir
    9. End Sub
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  11. #11
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    oops its not Dir1.Dir its Dir1.Path

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. Dir1.Path= GetSetting(App.EXEName, "Options", "Last Dir")
    5. End Sub
    6.  
    7. Private Sub Form_Unload(Cancel As Integer)
    8. SaveSetting App.EXEName, "Options", "Last Dir", Dir1.Path
    9. End Sub
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  12. #12

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    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.

  13. #13

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    Yea Buggy I figured that one out. I'm not a totall basket case.

    I just still cant get it to work

  14. #14
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    oops it wasnt you it was the 'But_Why' guy...... and i have no idea why he added that part.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  15. #15
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Originally posted by DavidH0011
    Yea Buggy I figured that one out. I'm not a totall basket case.

    I just still cant get it to work
    do you have a DirListBox called Dir1?

    and maybe try putting
    On error resume next
    before the GetSetting part.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  16. #16

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    Yup

    and as far as I can see my EXE is called ImageConverter

    Hell I wrote the program it has just been soooo long

  17. #17

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    This is exactly what it looks like

    Private Sub Form_Load()
    Dir1.Path = "c:\"
    Dir1.Path = GetSetting(App.ImageConverter, "Options", "Last Dir")
    End Sub

  18. #18
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    try putting

    On error resume next

    because if there is not an entry there it will error i think.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  19. #19

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    Nah same result, the problem continues to be on the ".ImageConverter" in the App.ImageConverter

    How can I confirm what my EXE is called?

  20. #20
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    o my god...........

    it doesnt mean replace it with it.

    ACTUALLY USE .EXEName

    MANANANAMNFMANVGMANDBMNASDBHNBHBKL

    not .ImageConverter

    GODOGODOGODGODOGODGODOG

    sorry.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  21. #21
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    use my EXACT EXACT EXACT code. DONT CHANGE THE APP.EXENAME

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. Dir1.Path= GetSetting(App.EXEName, "Options", "Last Dir")
    5. End Sub
    6.  
    7. Private Sub Form_Unload(Cancel As Integer)
    8. SaveSetting App.EXEName, "Options", "Last Dir", Dir1.Path
    9. End Sub
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  22. #22

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    17
    LMAO jee imagine that it works now.

  23. #23
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    Seems like an Honest mistake to me
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width