anybody know what code to add to open a html file through HTMLVIEWER so to display it on a pocket pc.
Printable View
anybody know what code to add to open a html file through HTMLVIEWER so to display it on a pocket pc.
Have you tried the sample that OpenNetCF has on their site?
yap.. but what I want is to open a particular html file in the local drive, not through IIS or directly open, but open through a program to execute. Thanks for the reply
I see. But they just use a StreamReader to get the text from the url. I haven't tried to open a local file, but I would think a similar technique could be used.
ook.. I try to read text from a text file and it works, but i don't know how to open a html file or read to display the content of the html file through the htmlviewer, can you reply the technique or code that you thinking? thanks alot
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
' show a wait cursor
Cursor.Current = Cursors.WaitCursor
' load HTML from the supplied URL
'viewer.DisplayText(GetHTMLFromURL(txtURL.Text))
Dim sr As StreamReader = New StreamReader("TestFile.txt")
Dim line As String
line = sr.ReadLine()
sr.Close()
viewer.DisplayText(line)
End Sub
--> created a text file name TestFile, input some text in it. When the GO button is press, the message inside the TestFile will be display out. Please ignore the url field.
Been out of town for a while, sorry to not reply earlier. Looks like you've got something going if you can display a line of text. What you'd have to do, I think, is to suck up the entire html page, convert to text if necessary, and then display that.
Have not tried, but the OpenNetCF example uses StreamReader.ReadToEnd member, while your example uses .ReadLine - I'd give the ReadToEnd a shot first.
Sorry I'm too busy to try it myself - can you give it a go and post what happens?
Mike
Dim sr As StreamReader = New StreamReader("TestFile.txt")
Dim line As String
line = sr.ReadToEnd()
sr.Close()
viewer.DisplayText(line)
End Sub
--> yap, it can works with the ReadToEnd. I encounter another problem, the html page can be display but when i click the link on the page, it cannot navigate to the other page. It just stay in that page, my codes of linking in the html page is correct. Hope you can help me again, thanks for the reply
From the sample code provided by OpenNetCF:
VB Code:
' NOTE: This will not decode any images on the page, nor will any hyperlinks actually ' work. For those you need event handlers, which v 1.0 of the HTMLViewer does not support
You may want to go to the forums at OpenNetCF.org to see if there are workarounds/how to implement. I've never taken their control this far.
Mike
ok.. thanks alot