• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1518
  • Last Modified:

Webbrowser with compact framework.

This code works fine in an windows application under visual studio 2005. I need the same funcionality working in Compact Framework. I'm using PocketPC 2003.

ie is a webbrowser control.
Dim a As String
        ie.Navigate("http://www.google.com") 'or some url
        While Not ie.ReadyState = 4
            Application.DoEvents()
        End While
        a = ie.DocumentText
        MsgBox(a & a.Length) 'I need to to do something with a

Open in new window

0
dibanezb
Asked:
dibanezb
  • 4
  • 4
1 Solution
 
ChetOS82Commented:
What isn't working exactly?  Do you get an error of some sort?  I don't think that ReadyState is available on 2003.
0
 
dibanezbAuthor Commented:
First, I receive this error:
Property 'DocumentText' is 'WriteOnly'  (This in line 'a = ie.DocumentText')
If I delete this line, I can run the program but I receive then this error:

NotSupportedException was handled
And shows this tip: "check to determine if there is a class that supports this funcionality"

This happens both, if I deploy the application to the Device (Ipaq hx 2415) or to emulator.

I ReadyState is not available, how to know if the browser ends reading? Also I need to know what the browser read.

0
 
ChetOS82Commented:
From the .NET Compact Framework documentation at http://msdn.microsoft.com/en-us/library/ms229657.aspx

"The .NET Compact Framework does not support the Document property and its related properties and events, except for the DocumentText property. You can use DocumentText to present HTML to your users, such as to provide links and a simple HTML form, but the .NET Compact Framework does not support accessing the HTML content of a Web page with this property."

This explains why DocumentText is WriteOnly.  I cannot find a work around for this.  If you are simply trying to get the HTML code for a web site (and just using the WebBrowser control to do it), you could use the System.Net.WebClient to do the same thing.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
dibanezbAuthor Commented:
As you say, I just try to get the HTML code for a web site. System.Net.WebClient works fine with windows but it doesn't work with Pocket PC or Windows Mobile. Any other idea?
0
 
ChetOS82Commented:
You will have to use the System.Net.HttpWebRequest then.  It is harder to work with, but it works just as well.
0
 
dibanezbAuthor Commented:
Do you have an example or a link to obtain it?
0
 
ChetOS82Commented:
There are many, here is one: http://www.c-sharpcorner.com/UploadFile/mahesh/WebRequestNResponseMDB12012005232323PM/WebRequestNResponseMDB.aspx

Look at the bottom of the page (it talks about WebClient at the top).
0
 
dibanezbAuthor Commented:
Thanks, it works now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now