Solved

Hyperlink to a website

Posted on 2003-10-21
9
186 Views
Last Modified: 2012-05-04
I have a VB application.  I have a help/about button that when pressed fires off a form.  The form contains information about the application: version, date, regsitration etc.  I would like to add a commandbutton to the "about" form that would, when pressed, link to a web page (hypelink).  

How do I create the hyperlink using a commandButton?
0
Comment
Question by:bgdw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:blkbam
ID: 9595343
Can't go wrong when someone has done it for you.

http://www.developerfusion.com/show/340/3/

Just be sure to give the author proper credit  :)
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 9595348
Private 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
               
Private Const SW_SHOW = 1

'' then in onclick event of button

Private Sub Command1_Click()
  Dim href as String
  href = "http://www.google.com"
  hBrowse = ShellExecute(Me.hwnd, "open", href, vbnullstring, vbnullstring, SW_SHOW)
End Sub



0
 
LVL 1

Expert Comment

by:blkbam
ID: 9595360
But if you really want code:

Add a reference to "Microsoft Internet Controls"
then use the following code:

Public Sub LaunchSite(url As String)
    Dim ie As InternetExplorer
     Set ie = New InternetExplorer
    'open file in internet explorer
    With ie
        .Navigate2 url
        .Height = 800
        .Width = 700
        .Left = 25
        .Top = 25
        .Visible = True
    End With
    Set ie = Nothing
End Sub

url can be either a path and/or file name or an actual URL.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:BUCHAS
ID: 9595376
This article shows exactly what you want without use of any 3rd-party control, with the same look as an IE link... see which suits you better.

http://www.mvps.org/vbnet/code/intrinsic/sehyperlink.htm
0
 
LVL 5

Expert Comment

by:fantasy1001
ID: 9595469
'Put this in a module:
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

' And here is your code
Private Sub Command1_Click()
     Dim retval As Long
     retval = ShellExecute(hwnd, "Open", "http://www.google.com", "", App.Path, 1)
End Sub


Thanks & Cheers
0
 

Expert Comment

by:flynn2000
ID: 9602469
private sub command1_click()
    Shell ("explorer http://www.google.com")
End Sub
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 250 total points
ID: 9602715
my suggestion (which is pretty much the same as fantasy's) only posted first ;) is the solution i think you want to go with... it will open up the DEFAULT browser. Not dependant on IE.
0
 
LVL 1

Expert Comment

by:fsaims
ID: 9612703
Suggestion of bobbit31 will work out perfectly
0
 

Author Comment

by:bgdw
ID: 9645484
Thanks for the help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 65
Added a column screws up code 5 69
VB6 ListBox Question 4 55
IF ELSE Statement in Excel Macro VBA 16 87
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question