1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Retain File Path

Discussion in 'Visual Basic ( VB )' started by swapnaoe, Nov 9, 2006.

  1. swapnaoe

    swapnaoe New Member

    Joined:
    Oct 26, 2006
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    I have an application that browses for a file and displays the file path in a text box and the next time i run the application, i want the last browsed file in the text box. Please give me your ideas on this..

    Warm Regards,
    Swapna
     
  2. swapnaoe

    swapnaoe New Member

    Joined:
    Oct 26, 2006
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    Found the solution.. :)

    Here is how to use the Registry


    ' Save text1's value
    SaveSetting App.EXEName, "textboxes", "text1", text1.Text

    ' Get text1's value
    text1.text = GetSetting (App.EXEName, "textboxes", "text1", "")

    SaveSetting stores the data in the Registry (in HKEY_CURRENT_USER|Software|VB and VBA Program Settings|YourAppName). The four parts of the function are the name under which it is stored (App.EXEName in this case), "textboxes" in this example is like the section name in an ini file, "text1" is like the key in a line of data in the ini file, and text1.text is the value.

    GetSetting returns the value. The 4th parameter ("" in this case) is optional and it is the default if no registry entry is found.
     

Share This Page