Results 1 to 4 of 4

Thread: Link to a web site

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Link to a web site

    I want to click on a button within a VB6 application, which opens the standard Internet Explorer browser and automatically navigates to a web site.

    Can anyone please give me some help on how to do this with VB6

    thanks

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Link to a web site

    Wow, this seems topical lately. Homework assignment?

    This functionality is built into VB6. Any UserControl can do it.

    This example uses a Label to be the Hyperlink, but one could easily make it a button:
    Code:
    Private Sub lblLink_Click()
        If Len(m_URL) > 0 Then
            HyperLink.NavigateTo m_URL, m_Bookmark
        End If
    End Sub
    See attached demo.
    Attached Files Attached Files

  3. #3
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Link to a web site

    Here is another method.

    vb Code:
    1. 'Put this in a module
    2. Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    3. Public Const SW_SHOWNORMAL = 1
    4.  
    5.  
    6. 'Put this in a form
    7.  
    8. Private Sub lblSite_Click()
    9. ShellExecute Me.hWnd, vbNullString, "http://www.vbforums.com", vbNullString, "C:\", SW_SHOWNORMAL
    10. End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Re: Link to a web site

    Wonderful,

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width