Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 13th, 2006, 02:54 AM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default Link to a Website

I have a command button in my form and I want to know how to go to a website when a user clicks on the command button.

Public Sub button_click()

www.website.com

End sub

What is the syntax or command can I use?

Thanks

  #2 (permalink)  
Old June 13th, 2006, 04:15 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

check this..

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_SHOWNORMAL = 1

Private Sub Command1_Click()
ShellExecute Handle, "open", "http://www.yahoo.com", "", "", SW_SHOWNORMAL
End Sub

Add a button to the form and copy and paste the code in the code window.
It opens explorer with the weblink what you give there.

Hope this helps.


With Regards,
Raghavendra Mudugal
  #3 (permalink)  
Old June 15th, 2006, 09:55 AM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

Hi Raghavendra,

I copied and pasted your code and I am getting a compile error of " Only comments may appear after End Sub, End Function, or End Property. This error is happening on the Declare Function ShellExecute.

I must be doing something wrong.



  #4 (permalink)  
Old June 15th, 2006, 10:01 AM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

I see where I went wrong. Thanks for all your help.



Similar Threads
Thread Thread Starter Forum Replies Last Post
all about website benny HTML Code Clinic 2 February 11th, 2008 04:49 AM
Link Buttons Fail in Published Website qdd Visual Studio 2005 15 September 10th, 2007 01:29 PM
Dynamic website to Static website Aboal3ood ASP.NET 1.x and 2.0 Application Design 4 December 7th, 2006 11:46 AM
website using .net harrysingh26 Classic ASP Databases 0 October 3rd, 2005 05:24 AM
website development Futuregame BOOK: ASP.NET Website Programming Problem-Design-Solution 3 January 31st, 2004 06:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.