Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
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 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 September 8th, 2006, 02:59 AM
Registered User
Join Date: Sep 2006
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!

Old September 8th, 2006, 10:45 AM
Friend of Wrox
Join Date: Nov 2004
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.

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

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