Pocket PC

  • Thread starter Thread starter Sivaprasad
  • Start date Start date
S

Sivaprasad

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**********************
 
Hello,

Sivaprasad said:
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/d...l/frlrfsystemxmlxmldocumentclassloadtopic.asp
[2]
http://msdn.microsoft.com/library/d...ef/html/frlrfsystemiofileclassexiststopic.asp
 
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 said:
Hello,

Sivaprasad said:
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/d...l/frlrfsystemxmlxmldocumentclassloadtopic.asp
http://msdn.microsoft.com/library/d...ef/html/frlrfsystemiofileclassexiststopic.asp
 
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
 
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 said:
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 said:
Hello,

Sivaprasad said:
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/d...l/frlrfsystemxmlxmldocumentclassloadtopic.asp
http://msdn.microsoft.com/library/d...ef/html/frlrfsystemiofileclassexiststopic.asp
 
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
 
Back
Top