views:

51

answers:

3

Hi

I have a image and I want to display it on my phone emulator. So I made a image control and set the path like this

"C:\MyPhoneApp\img.jpg

I get a error like this

Could not find a part of the path

Where should I be storing these files so I can access them?

A: 

You should always use relative paths. You can never be 100% sure where a user will install the application or even if C:\ exists.

My suggestion would be to set the path to just: "img.jpg" and make sure that the file is installed in the same directory as the executable.

If you have many images, you might want the installer to create an images directory, in which case you would simply use "images\img.jpg".

Bob
I tried that too. I had something like this pictureBox1.Image = new Bitmap("ScreenShot011.jpg");
chobo2
A: 

The emulator's "paths" have absolutely nothing to do with the drive layout of the PC. The emulator is a virtual machine, so it's entire file store is inside a single file stored on the PC. If you want the emulator to have access to a PC file, you have to set up folder sharing in the emulator Options. Otherwise you have to copy the file to the emulator virtual machine (via remote file view, having studio deploy it or some other mechanism).

ctacke
Can you do step by step on how to setup both of these options?
chobo2
in the emulator:File | Config (in the emulator window menu, not in the emulated device)On the General Tab at the bottom are settings for 'shared folder', set that to the folder that your image file is in.Then in the emulator tap start | programs, File Explorer, and navigate to 'Storage Card', you should see your image file. Tap and hold the file to copy and paste it to the filesystem in the emulator, then change your code to read the file from there. E.G. copy the image file to '\My Documents\My Pictures' and then change your code to read the file from that path.
Matt
windows mobile doesn't have the concept of drives, everything starts from the root foldler '\'
Matt
A: 

You should always keep the file in your emulator to load it on Mobile,

and should always start giving path from Root("/").

suppose you keep image in folder "MyPhoneApp" at root level,then give path

"\MyPhoneApp\img.jpg".

Shadow