|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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!
|
|
#3
|
|||
|
|||
|
Quote:
Ok, I'll try so its App.Path = "D:\Presentation\" ?? |
|
#4
|
|||
|
|||
|
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. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Absolute Referencing in VB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|