View Full Version : VB: form button that opens a link in browser...

sir pannels
10-06-2002, 11:30 PM
hey hey:)
.. hm can this be done in vb? if so .. how?
sir p

10-11-2002, 05:35 AM
You bet you can, just dump this into your form and then copy the code thats in the Command1_Click() sub into the sub for the right button on your form.

Option Explicit
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 Sub OpenFile(sURL As String)
Dim nRetVal As Long
If sFile = "" Then Exit Sub
ShellExecute nRetVal, "open", sURL, "", "", 1
End Sub

Private Sub Command1_Click()
OpenFile "http://www.codingforums.com"

End Sub

sir pannels
10-12-2002, 01:07 AM
Thanks alot man:thumbsup: