Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2006, 01:52 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default Knowing File Path

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.

 
Old February 14th, 2006, 01:58 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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
 
Old February 14th, 2006, 02:25 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

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.

 
Old February 14th, 2006, 02:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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
 
Old February 14th, 2006, 02:46 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

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? :)

 
Old February 14th, 2006, 04:07 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

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.

 
Old February 14th, 2006, 04:22 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

yep.. you are rigth.. my mistake again..

try the streamreader class (and streamwritter).

http://msdn.microsoft.com/library/de...classtopic.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
 
Old February 14th, 2006, 04:30 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

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.

 
Old February 15th, 2006, 04:12 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirect URL to File path han_nomad C# 12 February 2nd, 2007 06:26 AM
Getting path of the file zorglub76 C# 4 December 23rd, 2005 04:25 AM
Invalid report file path cathiec Crystal Reports 0 June 30th, 2005 10:10 AM
Get File path maxpotters Excel VBA 4 April 6th, 2005 01:19 PM
How to get the File Path DarthSith ASP.NET 1.0 and 1.1 Basics 2 October 29th, 2004 02:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.