Groups | Blog | Home
all groups > dotnet compact framework > april 2008 >

dotnet compact framework : How can I see data files from a project when use Emulator?


Nina
4/29/2008 9:11:03 AM
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
Nina
4/29/2008 10:29:01 AM
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


[quoted text, click to view]
Nina
4/29/2008 11:19:01 AM
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.

[quoted text, click to view]
Nina
4/29/2008 12:23:02 PM
Thank you. It works.

[quoted text, click to view]
Chris Tacke, eMVP
4/29/2008 12:34:08 PM
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



[quoted text, click to view]

Ginny Caughey MVP
4/29/2008 12:45:53 PM
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

[quoted text, click to view]

--

Ginny Caughey
Device Application Development MVP

www.wasteworks.com
Software for Waste Management


Chris Tacke, eMVP
4/29/2008 1:35:53 PM
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


[quoted text, click to view]

Ginny Caughey MVP
4/29/2008 2:37:42 PM
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

[quoted text, click to view]

--

Ginny Caughey
Device Application Development MVP

www.wasteworks.com
Software for Waste Management


Bjørn Brox
4/29/2008 6:42:00 PM
Nina skrev:
[quoted text, click to view]

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.

--
AddThis Social Bookmark Button