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
Re: How to Link any label or command button to any website
VB Code:
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_NORMAL = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, "Open", "http://www.vbforums.com", 0&, 0&, SW_NORMAL
End Sub
Re: How to Link any label or command button to any website
thanks
it is workingvery well
:thumb:
Re: How to Link any label or command button to any website
:thumb:
Don't forget to mark this thread resolved
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
Re: How to Link any label or command button to any website
Just replace the address with a string variable, e.g.:
VB Code:
Private Sub Command1_Click()
ShellExecute Me.hwnd, "Open", Text1.Text, 0&, 0&, SW_NORMAL
ShellExecute Me.hwnd, "Open", Combo1.List(Combo1.ListIndex), 0&, 0&, SW_NORMAL
End Sub
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 :wave:
VB Code:
Dim address As String
Private Sub Command1_Click()
address = Combo1
ShellExecute Me.hwnd, "Open", address, 0&, 0&, SW_NORMAL
End Sub
Private Sub Form_Load()
Dim VbForum, Yahoo As String
VbForum = "www.vbforum.com"
Yahoo = "www.yahoo.com"
Combo1.AddItem VbForum
Combo1.AddItem Yahoo
End Sub
Re: How to Link any label or command button to any website
Thanks for reply Bush. Always I can rely on you
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
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
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?
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
Re: How to Link any label or command button to any website
Quote:
Originally Posted by
jmsrickland
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
Re: How to Link any label or command button to any website
Quote:
Originally Posted by
visualbasictutorials
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.
Re: How to Link any label or command button to any website
Quote:
Originally Posted by
ColinE66
Yep, that's what I thought. I did that just to see of an OP can give his thread a 5-star rating
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!
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
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 ;)