Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

 

I have a small console application which browses through some folders under ONE spesific folder. This folder is coded in the application (as a variable). I would like to use some kind of file (ini?) to set the path of this folder, and the application will use the folder specified in the file.

 

Anyone know how I'm able to do this?

  • *Experts*
Posted

If the only thing your file would contain is the folder path you can easily do it using IO.StreamReader class. If your file will contain more info then you will need to do some searching for the path.

'create a new stream reader so you can read the file
Dim reader As New IO.StreamReader("path to the file")
'store path somewhere, this is assuming you have one thing in a file like I said before
'read it using the ReadLine method which will get the whole line for you
dim folderpath as string = reader.ReadLine()
reader.Close()

:)

Posted

I made a class which returns the values of a file, and it works fine. But are there any other ways to make configuration files?

 

Anyway, thanks for you help. The application works as it should now.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...