Hi all
I am working with VB.NET 2003 for mobile application.
Here there is no likn label option.
But i want to open a html link in my VB.NET form.
Like may be on button click event or in form load event.

If any idea help me

Thanks and Regards
Sugan

Recommended Answers

All 7 Replies

Hi all
I am working with VB.NET 2003 for mobile application.
Here there is no likn label option.
But i want to open a html link in my VB.NET form.
Like may be on button click event or in form load event.

If any idea help me

Thanks and Regards
Sugan

Take a look at the mouse down event and then capture it on the label and the label.text, open your browser and paste the string from the label into the browser address bar.

Hi SolTec
Thanks for your reply
Can u guide me with some sample code
Thanks

Hi SolTec
Thanks for your reply
Can u guide me with some sample code
Thanks

In the mouse down event, try this code on the label.

Dim URL As String
Dim Name As String
URL = "http://www.yoururllink.com/"
Name = lblName.Text = "YourURLLinkName"
Try
Shell("C:\Program Files\Internet Explorer\IEXPLORE.exe " & URL), AppWinStyle.NormalFocus)
Catch ex As Exception
MsgBox("Your browser isn't allowing the connection to " & URL)
End Try

Hi
If i use the above code in my application it showing error on shell

the error is name "shell" is no declared.
do i need to import any package.

Thanks

Hi
Thanks for your reply
i got the result

if i click a button in my vb.net application it will link to an html page or to an website.

What i did is as follows
1. Create an HTML application
2. Add it to your VB.NET application
3. In the button click event write the following code.

Private Sub button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button.Click
        ShowPPCWebSite()
           End Sub


 <DllImport("coredll.Dll")> _
    Private Shared Function CreateProcess(ByVal strImageName As String, ByVal strCmdLine As String, ByVal pProcessAttributes As IntPtr, ByVal pThreadAttributes As IntPtr, ByVal bInheritsHandle As Integer, ByVal wCreationFlags As Integer, _
    ByVal pEnvironment As IntPtr, ByVal pCurrentDir As IntPtr, ByVal bArray As Byte(), ByVal oProc As ProcessInfo) As Integer
    End Function

Private Sub ShowPPCWebSite()
        Dim pi As New ProcessInfo
'Following is to open website
        CreateProcess("iexplore.exe", "www.microsoft.com/mobile/pocketpc/default.asp", IntPtr.Zero, IntPtr.Zero, 0, 0, _
        'IntPtr.Zero, IntPtr.Zero, New Byte(127) {}, pi)

'following is to open the HTML application in browser give your application path instead of "program files\VBS_UK\producttypes.html"

        CreateProcess("iexplore.exe", "\program files\VBS_UK\producttypes.html", IntPtr.Zero, IntPtr.Zero, 0, 0, _
       IntPtr.Zero, IntPtr.Zero, New Byte(127) {}, pi)
    End Sub

Needed same thing.

There was an error in the example Suganzini posted.

I corrected it and here is the version i used:

'URL = "http://www.google.com/"
        Try
            Shell("C:\Program Files\Internet Explorer\IEXPLORE.exe " & URL, AppWinStyle.NormalFocus)
        Catch ex As Exception
            MsgBox("Your browser isn't allowing the connection to " & URL)
        End Try

I made a program where you can enter the blu-ray movies you have in, with a collum in the database for a website like IMDB. so when i double click on a movie in my ListView it opens a webbrower with the link from the database.


The full code for the "double-click function":

Private Sub ListView1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick

        Dim URL As String


        Dim hent As String = "SELECT imdb FROM bluray WHERE id =@id"

        cmd = New SqlCommand(hent, con)

        con.Open()

        Dim id As Int16 = Convert.ToInt16(txtId.Text)
        cmd.Parameters.AddWithValue("@id", id)
        Dim datareader As SqlDataReader = cmd.ExecuteReader()

        Try

            While datareader.Read()
                URL = (datareader("imdb").ToString)
            End While

        Catch ex As Exception
            MsgBox(ex.ToString)
        Finally
            con.Close()
        End Try



        'URL = "http://www.google.com/"
        Try
            Shell("C:\Program Files\Internet Explorer\IEXPLORE.exe " & URL, AppWinStyle.NormalFocus)
        Catch ex As Exception
            MsgBox("Your browser isn't allowing the connection to " & URL)
        End Try




    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.