Results 1 to 5 of 5

Thread: How to create/access a config file in VB?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    singapore
    Posts
    86

    Unhappy How to create/access a config file in VB?

    Hi , I'm doing a VBA application. Inside my source codes, there are hundreds of locations where I'm accessing some folders to read.Actually my purpose of asking How to access a "Config file" in VB is bcoz, my app might be transfered to other PC. I want the users to set the folder paths in a text file for their comfort,lets say config.txt(in the format which I've attached or even better if u can think of).y? so that my vb program is maintainable and the users(NOT PROGRAMMERS) need not go thru the source codes to change the directory path one by one... It will be assumed that if they change the path in the txt file, then when they run the program, it should run without any problem(like File Does Not Exist)..and things like that...Understand my friend? So I want a code that could be placed with my source codes so that whenever I need to access a file, I need not do this:"c:/windows/GetTT/..." Instead I want to simply call "_App_Path", and so my program will read the config.txt line by line and when it sees "_App_Path", it will read the next line, which is the directory path(See my prev Attached).Hope u would help me...Thanks a lot.
    Attached Files Attached Files
    Last edited by ITboy; Apr 3rd, 2003 at 02:48 AM.

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Sounds like a good idea,
    it has been done lot's of times
    For VB programms I'd use ini-files. Look for the API's GetPrivateProfileString to read and WritePrivateProfileString an INI-File.

    Since you are using VBA, your code is running with a file (excel or something) Why don't you save the data in there.

    As for the code, just aasign at the start of the application the correct value for your Folder_Path and the nuse it.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3
    Junior Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    23
    hmmm ... looks similar to another post I just read ...

    For this purpose, ini files good, registry bad

    Dave

  4. #4
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Hi daughey
    I was already starting to think of some kind of desease I could have (Alzheimer or so...).
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  5. #5
    Junior Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    23
    Yes, I was having deja vu reading the initial post ... thought I was loosing my mind for a moment ...

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