hello,
I want to link a text file in my userform.
Can i use linklabel for hyperlink?
please help me...........
thanks in advance.:confused:

Recommended Answers

All 2 Replies

Yes you can. If you are wanting the hyperlink to open a browser and go to the URL specified use the following code:

Process.Start("http://www.google.com/")

And if you are wanting to start a text file located on your client or in your debug folder you can use this code:

Process.Start(Application.StartupPath + "\test.txt")

This code above opens the text file located where your application starts up from.

Member Avatar for Unhnd_Exception

Another example

Public Class Form1

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        LinkLabel1.Text = "Click here to go to a link"

        'After setting the text of the link label the
        'whole text is clickable portion of the link.

        'You can optionally designate only a certain 
        'portion of the text as the clickable link text
        'with the LinkArea.

        'This is hard coded to make the above
        'text's "link" portion clickable.
        Dim LinkArea As New LinkArea(22, 4)
        LinkLabel1.LinkArea = LinkArea

    End Sub

    Private Sub LinkLabel1_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        'Handle the Link Clicked event to go to
        'the external link.
        Process.Start("http://www.google.com")
        'or
        'Process.Start(YourFilePath)
    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.