By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,165 Members | 1,429 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,165 IT Pros & Developers. It's quick & easy.

Pocket PC

P: n/a
Hello,

I am a beginner in Pocket PC development.
I am trying to load an xml into a treeview control of pocket pc.
Its throwing an exception "Directory not found"
But the same piece of code is working in .NET regular environment not Pocket
pc.

For pocket PC is there any other library i should import to refer the xml
object?.

Below is the code snippet i am using.
Can any one help me?
Any help is highly appreciated.

Thanks
Siva

'**************************Code Snippet **********************
Imports System.Xml


Private Sub cmdLoadXML_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdLoadXML.Click
Dim xmldocTest As New XmlDocument

Try

xmldocTest.Load("C:\My DotNet\abc.xml")
(The exception is triggered on this line)

DisplayXmlNode(xmldocTest, tvwLoadXML.Nodes)

' Expand the root node.
tvwLoadXML.Nodes(0).Expand()

Catch GetError As System.Exception
MessageBox.Show(GetError.Message)
End Try

End Sub

'**************************Code Snippet Ends**********************
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hello,

"Sivaprasad" <ss********@hotmail.com> schrieb:
I am a beginner in Pocket PC development.
I am trying to load an xml into a treeview control of pocket pc.
Its throwing an exception "Directory not found"
But the same piece of code is working in .NET regular
environment not Pocket


The code should work, the 'Load' method is even supported in the Compact
Framework (see [1]). Are you sure the file exists? What does 'File.Exists'
[2] return for the filename?

[1]
http://msdn.microsoft.com/library/de...sloadtopic.asp
[2]
http://msdn.microsoft.com/library/de...xiststopic.asp

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

P: n/a
There is no C:\ drive on a PDA. Typically, you'd use something like
"\Storage Card\Somefile.xml" or "My Documents\..." The file system is one
of the most radical differences between desktop and PDA apps. If you don't
have it yet, The .NET Compact Framework Core Reference by MS Press is a Must
Have, and Dan Fergus and Larry Roof have a book from APress coming out any
day now...it's over 1000 pages and you'll want to pick it up too.

HTH

Bill
"Sivaprasad" <ss********@hotmail.com> wrote in message
news:uF**************@TK2MSFTNGP09.phx.gbl...
Hello,

I am a beginner in Pocket PC development.
I am trying to load an xml into a treeview control of pocket pc.
Its throwing an exception "Directory not found"
But the same piece of code is working in .NET regular environment not Pocket pc.

For pocket PC is there any other library i should import to refer the xml
object?.

Below is the code snippet i am using.
Can any one help me?
Any help is highly appreciated.

Thanks
Siva

'**************************Code Snippet **********************
Imports System.Xml


Private Sub cmdLoadXML_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdLoadXML.Click
Dim xmldocTest As New XmlDocument

Try

xmldocTest.Load("C:\My DotNet\abc.xml")
(The exception is triggered on this line)

DisplayXmlNode(xmldocTest, tvwLoadXML.Nodes)

' Expand the root node.
tvwLoadXML.Nodes(0).Expand()

Catch GetError As System.Exception
MessageBox.Show(GetError.Message)
End Try

End Sub

'**************************Code Snippet Ends**********************

Nov 20 '05 #3

P: n/a
Hello Herfried,

Yah the file exists.
I ran the same code in regular one it works.
I added this piece of code in both the environment
'****

Import system.IO

if File.exists("C:\My Dotnet\abc.xml") then

endif

'****
It returns true in regular but in Compact framwork it returns false value.
Why? is it something to do with the path.
I tried putting the file in root, thinking that, it is something to do with
the space in the path and Compact frameweork may have problem in it. But
still File.exists returns false.

Thanks
Siva


"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hello,

"Sivaprasad" <ss********@hotmail.com> schrieb:
I am a beginner in Pocket PC development.
I am trying to load an xml into a treeview control of pocket pc.
Its throwing an exception "Directory not found"
But the same piece of code is working in .NET regular
environment not Pocket
The code should work, the 'Load' method is even supported in the Compact
Framework (see [1]). Are you sure the file exists? What does

'File.Exists' [2] return for the filename?

[1]
http://msdn.microsoft.com/library/de...sloadtopic.asp [2]
http://msdn.microsoft.com/library/de...xiststopic.asp
--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet

Nov 20 '05 #4

P: n/a
See my other post...there's no C:\ on the PDA, but there is on the desktop.

In general, as a design guildeline, Use an Assertion before you refernece
the file to make sure it exists.

Debug.Assert(File.Exists("C:\Whatever"), "Doesn't Exist)

It's the same as an if block in some regards, but you'll know it blew up
immediately and where it blew up.
This is a typical find in C#
@"Storage Card\License.xml"; in VB.NET it'd be "Storage Card\License.xml"

Cheers,

Bill
"Sivaprasad" <ss********@hotmail.com> wrote in message
news:uh*************@TK2MSFTNGP12.phx.gbl...
Hello Herfried,

Yah the file exists.
I ran the same code in regular one it works.
I added this piece of code in both the environment
'****

Import system.IO

if File.exists("C:\My Dotnet\abc.xml") then

endif

'****
It returns true in regular but in Compact framwork it returns false value.
Why? is it something to do with the path.
I tried putting the file in root, thinking that, it is something to do with the space in the path and Compact frameweork may have problem in it. But
still File.exists returns false.

Thanks
Siva


"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hello,

"Sivaprasad" <ss********@hotmail.com> schrieb:
I am a beginner in Pocket PC development.
I am trying to load an xml into a treeview control of pocket pc.
Its throwing an exception "Directory not found"
But the same piece of code is working in .NET regular
environment not Pocket


The code should work, the 'Load' method is even supported in the Compact
Framework (see [1]). Are you sure the file exists? What does

'File.Exists'
[2] return for the filename?

[1]

http://msdn.microsoft.com/library/de...sloadtopic.asp
[2]

http://msdn.microsoft.com/library/de...xiststopic.asp

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet


Nov 20 '05 #5

P: n/a
Thanks Ryan

So how do i make it work now.
Should i copy the file to My Documents?
I did that too.
I copied the file to My Documents. Still it didn't work.
I tried all these combinations of paths
"My Documents\Thoughts.xml"
"\My Documents\Thoughts.xml"
"C:\document and settings\abc\My Documents\Thoughts.xml" 'Which, as u said
won't work any way"
Same result.

Please help
Siva

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eo*************@tk2msftngp13.phx.gbl...
There is no C:\ drive on a PDA. Typically, you'd use something like
"\Storage Card\Somefile.xml" or "My Documents\..." The file system is one
of the most radical differences between desktop and PDA apps. If you don't have it yet, The .NET Compact Framework Core Reference by MS Press is a Must Have, and Dan Fergus and Larry Roof have a book from APress coming out any
day now...it's over 1000 pages and you'll want to pick it up too.

HTH

Bill
"Sivaprasad" <ss********@hotmail.com> wrote in message
news:uF**************@TK2MSFTNGP09.phx.gbl...
Hello,

I am a beginner in Pocket PC development.
I am trying to load an xml into a treeview control of pocket pc.
Its throwing an exception "Directory not found"
But the same piece of code is working in .NET regular environment not

Pocket
pc.

For pocket PC is there any other library i should import to refer the xml object?.

Below is the code snippet i am using.
Can any one help me?
Any help is highly appreciated.

Thanks
Siva

'**************************Code Snippet **********************
Imports System.Xml


Private Sub cmdLoadXML_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdLoadXML.Click
Dim xmldocTest As New XmlDocument

Try

xmldocTest.Load("C:\My DotNet\abc.xml")
(The exception is triggered on this line)

DisplayXmlNode(xmldocTest, tvwLoadXML.Nodes)

' Expand the root node.
tvwLoadXML.Nodes(0).Expand()

Catch GetError As System.Exception
MessageBox.Show(GetError.Message)
End Try

End Sub

'**************************Code Snippet Ends**********************


Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.