How can I easily add a simple HyperLink to a form? Can I put something in the Click() event?
-Steve
Printable View
How can I easily add a simple HyperLink to a form? Can I put something in the Click() event?
-Steve
You could put this in the onclick event of something....
Set x = CreateObject("InternetExplorer.Application")
x.Visible = True
x.navigate url
maybe there is an easier way.....
"Give a man a fish, he will eat for a day. Show the man HOW to fish, he will eat for a lifetime."
This is a pretty common question, I think I asked before myself. Click the search button, and type in "hyperlink label" and you will get about 15 different threads on the issue.
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 Sub Label1_Click() ShellExecute Me.hwnd, "Open", "http://www.vb-world.net", _ vbNullString, vbNullString, SW_SHOWNORMAL End Sub
Thanks guys.
I used the code that Mathew posted. The only thing I had to do is declare a constant SW_SHOWNORMAL with a value of 1.
-Steve
To make the look more "real", you could make the label change color on mousemove and mouseout. And you can also set the font to underlined, Arial
I'm doing this on an Image control and there is no mouseout event. How else can I accomplish changing the mousepointer?
-Steve
changing mousepointer is easy.
There is a mouseicon property which you can set to your cursor and change the mousepointer property to 99(custom).
There isn't mousout for any control in VB.
Easy way..
For the tough and more reliable way look in www.vbaccelerator.comCode:Private Sub Form_MouseMove()
Label1.Color = vbBlue
End Sub
Private Sub Image1_MouseMove()
Label1.color = vbRed
End Sub
the thread I posted has code to change the cursor....