SunQuest
 
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 26th, 2004, 05:48 PM
agentcid agentcid is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 11 agentcid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Absolute Referencing in VB

I have a code, so when I click on a button, it displays a image. This won't let me write a short path like "\images\hi.jpg". I have to write the full path "C:\My Program\images\hi.jpg" when I compile this, and send it to school. I'll be running off a H:\ so the path is different. Is there anycode that chops down the path? This is for my computing project and it will be marked on a different machine to the one I am writing it on.

Thanks in advance.

Reply With Quote
  #2  
Old July 27th, 2004, 12:19 PM
spak111 spak111 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 349 spak111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 25 sec
Reputation Power: 5
Send a message via AIM to spak111
To relative referencing from your program, use App.path which returns the string of the path of your application. Then you can append "\images\hi.jpg" or whatever pictures you have to that, as long as the images folder is in the same path as your program. I hope this helps!

Reply With Quote
  #3  
Old July 27th, 2004, 07:16 PM
agentcid agentcid is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 11 agentcid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Re: Absolute Referecing in VB

Quote:
Originally Posted by spak111
To relative referencing from your program, use App.path which returns the string of the path of your application. Then you can append "\images\hi.jpg" or whatever pictures you have to that, as long as the images folder is in the same path as your program. I hope this helps!


Ok, I'll try so its App.Path = "D:\Presentation\" ??

Reply With Quote
  #4  
Old July 28th, 2004, 07:21 AM
spak111 spak111 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 349 spak111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 25 sec
Reputation Power: 5
Send a message via AIM to spak111
No, App.Path is a read only property that will return the path of where the program is running from. If you have the program running from "D:\Presentation", then that is what it will return. You can't set it to anything specific, its a read only property. For example on its use, if you have an image folder within the folder where your project is running you can reference anything in that folder like so:
Code:
dim filePathName as string
filePathName = App.Path & "\image\NameOfImage.jpg"

This way you don't always have to have the absolute reference to the file from the project, only the relative, which is much more useful. I hope this clears things up for you.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Absolute Referencing in VB


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway