RSS Forums RSS
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums

Adding pictures

Join Date: Jul 2005
Posts: 31
Reputation: AlanC is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
AlanC's Avatar
AlanC AlanC is offline Offline
Light Poster

Re: Adding pictures

  #6  
Sep 13th, 2005
OK so if I'd read your original post properly... for loading a still image into an image control jwshepherds code will work fine. But back to the movies!

Now if you had to change the object name, you might have used the new mediaplayer. No problem if it works for you in your application.

Getting the path right is something you need to be aware of when developing in VB, and it's best to explicitly set it. Two useful things are the App.Path property which returns the path of the application as a string... just type in the 'immediate' window of your VB editor:
print app.path
Hit enter and you should see:
C:\Program Files\Microsoft Visual Studio\VB98\MyApp
or similar. The other useful thing is the ChDir command, which sets the current directory. The 'current directory' is where VB will look for any file you specify without the full path. You'll probably want to use the directory the app runs out of for any associated files, so you can use the following statement to change the directory to the application's:
'change directory to the application's
ChDir App.Path
'load the file
mediaplayer1.filename="intro.mpg"
You can also use the App.Path property together with a filename like these examples:
mediaplayer1.filename=app.path & "\intro.mpg"
'when the files dir is a sub-dir of the application's
mediaplayer1.filename=app.path & "\music\background.mp3"
Note that the backslash has to be provided as the path doesn't include this. Beware of hard-coding paths into your program- if the user installs it somewhere else, they'll get an error when the app tries to load the file; so the method shown above is good practice.

cheers
Alan
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:17 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC