Results 1 to 18 of 18

Thread: How to Link any label or command button to any website

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    How to Link any label or command button to any website

    Hi all
    I want to link a label or command button to a particular web page
    What is the method for it?
    Can any one send me it’s coding.
    Miss I want that when I click on any command button at my form then it open the website vbforums.com.
    Help me
    Thanks

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: How to Link any label or command button to any website

    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
    2.                 ByVal hwnd As Long, _
    3.                 ByVal lpOperation As String, _
    4.                 ByVal lpFile As String, _
    5.                 ByVal lpParameters As String, _
    6.                 ByVal lpDirectory As String, _
    7.                 ByVal nShowCmd As Long) As Long
    8.                
    9. Private Const SW_NORMAL = 1
    10.  
    11. Private Sub Command1_Click()
    12.     ShellExecute Me.hwnd, "Open", "http://www.vbforums.com", 0&, 0&, SW_NORMAL
    13. End Sub

  3. #3

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Arrow Re: How to Link any label or command button to any website

    thanks
    it is workingvery well

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: How to Link any label or command button to any website



    Don't forget to mark this thread resolved

  5. #5
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    Re: How to Link any label or command button to any website

    Hi all, hi Bush

    BTW: I would like about something to ask
    This function with these parameters be required for each page www?
    It is possible in order to replace "http://www.vbforums.com" any written in textbox adress or chosen the adress in Combo?

    Thanks in advance
    I know, I know, my English is bad, sorry .....

  6. #6
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: How to Link any label or command button to any website

    Just replace the address with a string variable, e.g.:
    VB Code:
    1. Private Sub Command1_Click()
    2.     ShellExecute Me.hwnd, "Open", Text1.Text, 0&, 0&, SW_NORMAL
    3.  
    4.     ShellExecute Me.hwnd, "Open", Combo1.List(Combo1.ListIndex), 0&, 0&, SW_NORMAL
    5. End Sub

  7. #7
    Hyperactive Member Bearnerd's Avatar
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    290

    Re: How to Link any label or command button to any website

    Here a code 4 u Tamgovb! It's a simple code to extent Mr Bush explaination. Try to use and modified the code. You'll find it useful and exciting


    VB Code:
    1. Dim address As String
    2.  
    3. Private Sub Command1_Click()
    4.     address = Combo1
    5.     ShellExecute Me.hwnd, "Open", address, 0&, 0&, SW_NORMAL
    6. End Sub
    7.  
    8. Private Sub Form_Load()
    9.     Dim VbForum, Yahoo As String
    10.     VbForum = "www.vbforum.com"
    11.     Yahoo = "www.yahoo.com"
    12.     Combo1.AddItem VbForum
    13.     Combo1.AddItem Yahoo
    14. End Sub

  8. #8
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    Re: How to Link any label or command button to any website

    Thanks for reply Bush. Always I can rely on you
    I know, I know, my English is bad, sorry .....

  9. #9
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    Re: How to Link any label or command button to any website

    Yeah, thanks Bearnerd, thanks very much, I will practice now, it with certainty will be useful.

    I greet
    I know, I know, my English is bad, sorry .....

  10. #10
    New Member
    Join Date
    Jun 2014
    Posts
    2

    Lightbulb Re: How to Link any label or command button to any website

    I know this forum was created many of years ago, but I came across the issue today since I'm a beginner.
    I searched for many of hours to finally find the proper & easiest way to link buttons up or linklabels up with URL's.
    Since there was no videos out there showing how to do it, I made one & here is the link for it https://www.youtube.com/watch?v=zyIVb9D8UGU

  11. #11
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: How to Link any label or command button to any website

    How does this simple ordinary run-of-the-mill thread get a five star rating and why?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  12. #12
    Hyperactive Member
    Join Date
    Oct 2013
    Posts
    389

    Re: How to Link any label or command button to any website

    keep in mind that sometimes simply using Shell may be preffered if you're giong to release it to public,
    as for some reason antiviruses seem to hate shell executes.

    Code:
    Public Function LoadURL(url as String)
        Shell("explorer http://" & url , vbNormalFocus)
    End Function
    'usage example: LoadURL("www.google.com")

    So make your pick
    Last edited by stum; Jul 1st, 2014 at 01:38 AM.

  13. #13
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: How to Link any label or command button to any website

    Quote Originally Posted by jmsrickland View Post
    How does this simple ordinary run-of-the-mill thread get a five star rating and why?
    Same reason this one did, probably.

    http://www.vbforums.com/showthread.p...a-MSHFlex-grid
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  14. #14
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: How to Link any label or command button to any website

    Quote Originally Posted by visualbasictutorials View Post
    I know this forum was created many of years ago, but I came across the issue today since I'm a beginner.
    Thanks for trying to help but you are using VB.NET and this is for VB6.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  15. #15
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: How to Link any label or command button to any website

    Quote Originally Posted by ColinE66 View Post
    Same reason this one did, probably.

    http://www.vbforums.com/showthread.p...a-MSHFlex-grid
    Yep, that's what I thought. I did that just to see of an OP can give his thread a 5-star rating


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  16. #16
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: How to Link any label or command button to any website

    I realised that was possible when I noticed that salsa's threads always got 5 stars!
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  17. #17
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: How to Link any label or command button to any website

    I've always wondered how so many threads got a 5 star. Now some are worthy but a lot I just can't see it. OPs should not be allowed to rate their own threads - the site should change that


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  18. #18
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: How to Link any label or command button to any website

    Meh, not so sure about that. Most threads are unrated period. This suggests that the ONLY people who tend to rate threads are the OP's of those threads. Remove the functionality from them and it won't get used at all! If you see a 5* thread that you think should be lower you could always balance it out with a rating of your own
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

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