Label Link

.net , vb6 New Zealand
  • 18 years ago

    How do you make a web-link out of a label?

  • 18 years ago

    Code:

    Private Sub Label1_Click()
          Call Shell("explorer " & """" & Label1.Caption & """", vbMaximizedFocus)
    End Sub


    of course that label1.caption must be something like
    http://www.developerfusion.com/forums/              
    Underlined,blue,that "hand" mouse pointer...


    Of course there are some issues left (on some windozes this will not work i think...)


    Hope this help!
    Xcuse my english....

  • 18 years ago


    an example like this ??


    the web address/email address is stored in the labels tag.  cos link names can be different from there values..
    (like the above link)


    Visual .NET has a link label control, its used from a .dll from Office XP, but i dont know nothink bout that


  • 18 years ago

    You're right with the "tag"!!!

  • 18 years ago

    thanks, I'll be able to use that now

  • 18 years ago

    wouldnt you like the code ?


  • 18 years ago

    wait...


    yeah, come to think of it, it would help

  • 18 years ago


    Bra


    its really not that difficult to modify.  The sub Main() has a loop which monitors the mouse movement so we can tell when the mouse has moved off of the label (and therefore unhilight the label)




  • 18 years ago

    If you are using .NET and creating a VB.NET application there is a label called the link label.  You can set the color with like LinkLabel1.color = colors.silver (i believe, the namespace can be just color though).  You would then add a mouse_click event from the top of the code editor that associates with your label like:


    private sub LinkLabel1_Click(sender as system.object, e as system.eventargs) handles LinkLabel1.Click
    end sub


    if you are going to add custom handlers (not selected from the code window at the top) then you'll have to add the handler by:


    addhandler LinkLabel1.click, addressof me.Linklabel1_click
    takes the form of:
    addhandler <event>, addressof <custom sub>


    note the .Click at the end, it pretty much says that this sub is going to handle the click event of this label.  


    I'm at School and we don't have the .NET framework installed here, so I can't really help you.
    I hope that helps


    Tony Ho

  • 18 years ago

    You can use FWLink in FASTlib. This control allows to create links in your applications.

  • 18 years ago

    manuroibal , wtf? you work for FastLib or something? every post i went to has the message to use FastLib.


    If you want a label control which can emulate a hyperlink then email me for it! i use it in our apps(take a look at the credits in HotHTML 2001 and hover over ppls name). and to get the URL's use the ShellExecute API. Works everytime.


    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


    Call ShellExecute(0&, vbNullString, "http://www.developerfusion.com/", vbNullString, vbNullString, 1)



    heres a function you can call anywhere in your app(dump into module):


    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
    Function OpenURL(strURL As String)as long
    openurl= ShellExecute(0&, vbNullString, strURL, vbNullString, vbNullString, 1)
    End Function


    Hope that helps!


    Good Luck!

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer Science is no more about computers than astronomy is about telescopes.” - E. W. Dijkstra