how do i make a label that when clicked it will open a new IE window and goto an address i specified?
Printable View
how do i make a label that when clicked it will open a new IE window and goto an address i specified?
I believe there is a tip on that...should be called something like, "creating hyperlinks in richtextbox's"...;)
errrrr
Try this:
Code: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
Public Const SW_SHOWNORMAL = 1
Private Sub Label1_Click()
ShellExecute Me.hwnd, vbNullString, "http://www.vb-world.net", vbNullString, "c:\", SW_SHOWNORMAL
End Sub
If it's only IE then there's a much simpler way.
First, add microsoft internet controls to your reference and:
and you can have FULL control over IE.Code:Dim ie as New InternetExplorer
ie.Navigate "URL"
doesnt work..
Did you add Microsoft Internet Controls as a reference?
Code:Dim ie as New InternetExplorer
Private Sub Form_Load()
ie.Navigate "http://www.vb-world.net"
ie.Visible = True
End Sub
what is a reference? I have the internet control on the form but it has an error
That is why you get the error. You set it as a Custom Control.
REFERENCE <> CUSTOM CONTROL
Add it as a Reference, it should be above the Custom Control item on the menu.
Nah, forget IE, use the ShellExecute method, doesn't take up resources and it easier to manage and also work for netscape (if that's the default browser, in fact in can be any program, as long as it's associated with URLS) so it reflects the users preference.
You are right about that Jop. I did post the code, but he didn't say anything, so I thought he wanted to use the Microsoft Internet Control as a reference.
That just goes to show you, I'm right, as always :rolleyes:.