|
-
January 6th, 2000, 06:02 PM
#1
Url link in a label
How would you put a Url link, so the user can click on it and it takes them to the url of the link?
-
January 6th, 2000, 06:16 PM
#2
Re: Url link in a label
Karl Peterson has a good (free with code) usercontrol (called HyperLabel ?) for download on his site at http://www.mvps.org/vb - I think it comes with a sample project also.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
January 6th, 2000, 08:59 PM
#3
Re: Url link in a label
i suppose if you want to do that, then you need more code with it:
you have to have a way to check if the user is hooked up to the internet.
the user must have a browser (IE 4, NE 4)
you could, as a desperate attempt, open IE 4, use a SendKeys function to send the label to it, and then sendkeys enter...this is a last attempt
you can find the codes for hooked up to the internet in www.vbcode.com - there are several of them.
there is a code which you can see if a fileexists there too, it is vbhelper.
-
January 7th, 2000, 03:40 AM
#4
Re: Url link in a label
A simple way of opening a browser window with a specified URL is as follows :
'
' Place this declare in a BAS / CLS / FRM module as appropriate
' not forgetting to change public to private where required !
'
public 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 Sub ExecuteLink(byval sLinkTo as string)
'
' Execute the passed Link
'
on error resume next
'
Dim lRet as Long
Dim lOldCursor as Long
'
lOldCursor = Screen.MousePointer
'
Screen.MousePointer = vbHourglass
'
lRet = ShellExecute(0, "open", sLinkTo, "", vbNull, SW_SHOWNORMAL)
'
If lRet >= 0 And lRet <= 0 then
Screen.MousePointer = vbDefault
MsgBox "error Opening Link to " & sLinkTo & vbCrLf & _
vbCrLf & Err.LastDllError, , "ExecuteLink"
End If
Screen.MousePointer = vbDefault
'
End Sub
This allows you to call the 'ExecuteLink' routine in ways such as :
ExecuteLink "http://codeguru.developer.com/vb"
'
' or
'
ExecuteLink "mailto:[email protected]"
The MSDN has a huge article somewhere that shows how to detect what your default browser is (if any) and also how to detect if you are connected to the internet (can't remember the URL's off the top of my head though).
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
January 7th, 2000, 04:32 AM
#5
Re: Url link in a label
I'm not putting anybody down in any way, but I love it when people post saying:
"yeah, I know of something like that. I think it's called &*&^%, but I don't remember where I found it."
Well, I think it's funny.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|