How can I see data files from a project when use Emulator?

N

Nina

Right now I don't have actual Mobile device and I try to run my project from
Visual Studio 2005 using Mobile 6 Professional Emulator. However, Emulator
cannot see files on my local PC. Do I have to create a Storage Card? I added
files to my project. How can I access them? Thanks a lot.
 
B

Bjørn Brox

Nina skrev:
Right now I don't have actual Mobile device and I try to run my project from
Visual Studio 2005 using Mobile 6 Professional Emulator. However, Emulator
cannot see files on my local PC. Do I have to create a Storage Card? I added
files to my project. How can I access them? Thanks a lot.

You access the files on your local PC in the same way as you would do it
on a real device, - by using some network connection :)

To turn it around: If you could see your local files from the emulator
it would not be a real emulator.
 
G

Ginny Caughey MVP

Nina,

Usually the easiest way to get test data onto an emulator is to deploy it
along with your app into the app's folder. You just add the data to your
project in VS and set its build property to Content.

Ginny

Nina said:
Right now I don't have actual Mobile device and I try to run my project
from
Visual Studio 2005 using Mobile 6 Professional Emulator. However, Emulator
cannot see files on my local PC. Do I have to create a Storage Card? I
added
files to my project. How can I access them? Thanks a lot.

--

Ginny Caughey
Device Application Development MVP

www.wasteworks.com
Software for Waste Management
 
N

Nina

Thank you, Ginny

In project I added folder “Data†with “Config.dat†file. I changed property
of Config.dat file to Content and property of “Copy to Output†to “Copy
alwaysâ€.

Now from the code I try to access that file:

If File.Exists(".\Data\Config.dat") = True Then
MessageBox.Show("File Found")
Else
MessageBox.Show("File Not Found")
End If

I got "File Not Found".
Do I need change Settings for the Emulator? If yes, what it should be?
Thank you, Nina
 
C

Chris Tacke, eMVP

Windows CE has no concept of a current directory, so relative paths cannot
be used. Use a fully-qualified path.

--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
N

Nina

I tryed full Path where project located and it doesn't work:

If File.Exists("C:\Nina\Newton\Demo1.0.1\Data\Config.dat") = True Then
MessageBox.Show("File Found")
Else
MessageBox.Show("File Not Found")
End If

Please, any ideas how to make it work. Thank you.
 
C

Chris Tacke, eMVP

Of course that doesn't work. There is no "C" drive on the CE device. The
emulator can be imagined as a completely separate physical device. It knows
nothing about the host PC or it's file system, just as the PC knows nothing
about the emulator and its file system. If you want to open a file, you
open it "locally" on the emulator. By adding it to the project as Content
and selecting "copy", Studio pushed it down to the device with the
application. Use the file browser on the emulator and you can find it (and
its path).


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
G

Ginny Caughey MVP

Nina,

WindowsCE doesn't have drive letters either. When the file gets desployed,
VS deploys it to the same folder as your app - usually something under
Program Files. So the full path would be something like \Program
Files\YourAppName\config.dat.

Ginny

Nina said:
I tryed full Path where project located and it doesn't work:

If File.Exists("C:\Nina\Newton\Demo1.0.1\Data\Config.dat") = True Then
MessageBox.Show("File Found")
Else
MessageBox.Show("File Not Found")
End If

Please, any ideas how to make it work. Thank you.

--

Ginny Caughey
Device Application Development MVP

www.wasteworks.com
Software for Waste Management
 
N

Nina

Thank you. It works.

Ginny Caughey MVP said:
Nina,

WindowsCE doesn't have drive letters either. When the file gets desployed,
VS deploys it to the same folder as your app - usually something under
Program Files. So the full path would be something like \Program
Files\YourAppName\config.dat.

Ginny



--

Ginny Caughey
Device Application Development MVP

www.wasteworks.com
Software for Waste Management
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top