Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old September 8th, 2006, 02:59 AM
Registered User
Join Date: Sep 2006
Location: Nidderau, Hessen, Germany.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Relative and Absolute Path question

Hello to everyone,

I am have a problem programming a Relative Path. I have read everything I could get my hands on. So I know it is what I want.
But there are a few questions that I still have.

1. Does this run in the background or do I have to reference it?

2. Do I need (or should I) program it in a Function?

3. Does anyone have a good example of this?
       All the examples I have found are either hard to follow or do
       not explain themselves very well.

(just a side note)
I need this for a Issue-Traking program. Will have around 20 users of the program. The issues that they enter will be saved in SQL Server 2005. This is of course not on a local machine but on a server (named: ServerSQL). When each of the users log into their workstations, the server (ServerSQL) is not pathed with the same drive letter. Some have it as Q:\, some as X:\...etc.
So this is the reason I need to use in the program a Relative Path.

Thanks in advance for your help!

  #2 (permalink)  
Old September 8th, 2006, 10:45 AM
Friend of Wrox
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

A relative path has to be relative to something.

The OS maintains a "current directory" (plain-speak term, not a technical term) for each drive. It also maintains a "Current Drive."

If the current drive is C, and the current directory of C is SomeFldr, the a reference to

     .open "SomeSubFldr\A_Text_Fil.txt"

will open


VB 6 has a ChDrive method that changes what the current drive is. Having changed drives this way, CurDir can be used to find out what the current folder is, or to change it.

In DOS we used DIR [Enter] to see what the current drive and directory was, as well as to see all the files in that directory.
C:[Enter] was used to make the C drive the current drive. (So this arrangement dates way back into the earliest of DOSís.)

Iím absolutely certain that .NET has similar functionality, since it reflects back to the underlying File System functionality.

So it looks as if you are going to have to gain some specific knowledge of the specific machineís configuration to be able to use relative paths (so that you can set the current drive, you see). I think that if you can gain that information, then there is no benefit to using relative paths at all. You would just concatenate the gleaned information with the predetermined path information, and use an absolute path.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
absolute path required?? atila Crystal Reports 0 April 29th, 2006 06:31 AM
VSProject need absolute path to the references acuze C# 0 April 18th, 2006 06:06 PM
relative/absolute positioning whacked bigal CSS Cascading Style Sheets 3 August 4th, 2005 12:06 PM
Convert logical path to absolute path zoostar J2EE 1 April 15th, 2005 10:36 AM
Absolute Path in Crystal Report lam_lvl Crystal Reports 5 August 19th, 2004 05:50 AM

All times are GMT -4. The time now is 11:35 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.