Question : Problem: VS 2005, Windows Mobile 5, Compact framework 2.0, vb.net open weblink?

VS 2005, Windows Mobile 5, Compact framework 2.0, vb.net open weblink?

How do you open a link to a website

Try
            System.Diagnostics.Process.Start("http://www.btsolved.com")
        Catch Ex As Exception
            MessageBox.Show("Error: " & Ex.Message)
        End Try

Does not work in CF2



Answer : Problem: VS 2005, Windows Mobile 5, Compact framework 2.0, vb.net open weblink?

Hello vonskie1,

What you mean saying "open weblink?"
1. If you want browse link you can just drop WebBrowser control from toolbox, then use following code:
Dim u As Uri = New Uri("http://www.btsolved.com")
webBrowser1.Navigate(u)
Take a look to following article:
Controls_: browser in your app
http://netcf2.blogspot.com/2005/11/controls-browser-in-your-app.html

2. If you want to download page you can use WebRequest class:
Imports System
Imports System.IO
Imports System.Net
Imports System.Text

            ' Create a request for the URL.        
            Dim request As WebRequest = WebRequest.Create("http://www.btsolved.com")

            ' Get the response.
            Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)

            ' Get the stream containing content returned by the server.
            Dim dataStream As Stream = response.GetResponseStream()

            ' Open the stream using a StreamReader for easy access.
            Dim reader As New StreamReader(dataStream)

            ' Read the content. Here is content of page!
            Dim responseFromServer As String = reader.ReadToEnd()

            ' Cleanup the streams and the response.
            reader.Close()
            dataStream.Close()
            response.Close()

Random Solutions  
 
programming4us programming4us