Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Go to Website in VB3

Status
Not open for further replies.

tturner

Technical User
Feb 28, 2002
3
US
In a VB3 application, how can I have a menu item, button click or something similar take the user to a specific web site url? What are my options?

Thanks
-Tim
 
In the BAS module of your application, add these declarations:

Declare Function ShellExecute Lib "SHELL" (ByVal hwnd%, ByVal lpszOp$, ByVal lpszFile$, ByVal lpszParam$, ByVal lpszDir$, ByVal fsShowCmd%) As Integer
Declare Function GetDesktopWindow Lib "USER" () As Integer
Global Const SW_SHOWNORMAL = 1


In your form, make a button and add this code to it. Change the HTML$ to whatever you like.
It will open the default browser (IE/Netscape) and load that page (providing you have a gateway)
You can also set HTML$ as a local file - eg. "C:\HELP\INDEX.HTM"


Sub Command1_Click ()
HTML$ = "Dim ret&
ret& = ShellExecute(Me.hWnd, "Open", HTML$, "", App.Path, 1)
End Sub

Let me know how you go.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top