Subject: Knowing File Path
Posted By: x_ray Post Date: 2/14/2006 12:52:34 PM
hello again,

i am writing an application in which the user sets some parameters, these parameters must be saved to a file in order to be retrieved later when the application runs.the problem is that how to remember the file path, in order to open the file next time the program is run and retrieve these information?
Thanks in advance.

Reply By: gbianchi Reply Date: 2/14/2006 12:58:45 PM
hi there..

you have problem with your config file or the data enter by the user?? you can have a config file (of any tipe, .ini, .xml, .txt or even a database) in you app directory that store the selection made by the user. you can even use the windows registry...

think what's the better aproach for you..

HTH

Gonzalo
Reply By: x_ray Reply Date: 2/14/2006 1:25:56 PM
as a matter of fact i was using an xls file to store these variables(i m using the excel automation published by microsoft), but if you can advise me about another way i will be very thankful, as i am new to this and need help badly.

Reply By: gbianchi Reply Date: 2/14/2006 1:35:27 PM
do some search on google about filesystemobject, that way you can store the data into a txt file if it not really important (just a path). just always be aware that the user can delete that file. You can find some examples on msdn.

HTH

Gonzalo
Reply By: x_ray Reply Date: 2/14/2006 1:46:30 PM
ok thanks for your great help, i will try to find the solution on the web, so thank you for giving me the starting point :)
(sorry for being annoying,but if i will have some further problems, you will still reply to me no? :)

Reply By: x_ray Reply Date: 2/14/2006 3:07:54 PM
hey it seems this too is more related to vb6.0,also can you give me some hints about using the windows registery to do this, all what i need is a way to store the values of four textboxes and 2 checkboxes on the form, and at next run to retrieve them, but the problem is how to know the file path, so if i save them into windows registery does that mean i dont have to worry about this?
Please advise.

Reply By: gbianchi Reply Date: 2/14/2006 3:22:36 PM
yep.. you are rigth.. my mistake again..

try the streamreader class (and streamwritter).

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiostreamreaderclasstopic.asp

if your data is persistant maybe you need a database??

and what your problem with the path.. if you know where you save it you also know where to find it (like in the app path) if you want to get the app path from .net you have to use a system.reflection something that is long enough to confuse even the better one. there is a topic on the help (changes from vb6 to .net) that xplain to you where can you find the app.path (the path where the application is running, a nice place to save your config files).

hope that this is now better.

HTH

Gonzalo
Reply By: x_ray Reply Date: 2/14/2006 3:30:02 PM
ok now that will surely help me, that what i wanted to know, see i dont want to use a database,because there is no server where i want to deploy the app. however i need the file path to be stored in the directory where the program is running(that is perfect because if i need to retrieve info from D:\somefile, chances might be that there is not D drive on a machine,there is F instead, at least that is what i am afraid of).
as for stream reader/writer, thanks a lot, but i ve already used some of its functionalities and i think it is time to go deep.
i will check all of this and get back to you, thanks for now, and wish you all the good luck.

Reply By: x_ray Reply Date: 2/15/2006 3:12:27 PM
ok thanks for your help, i am using the system.reflection now and everything is good, although it looks silly,but that is what i need for now.


Go to topic 12944

Return to index page 369
Return to index page 368
Return to index page 367
Return to index page 366
Return to index page 365
Return to index page 364
Return to index page 363
Return to index page 362
Return to index page 361
Return to index page 360