By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,220 Members | 1,091 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,220 IT Pros & Developers. It's quick & easy.

How to add LinkLabel in a ListBox

P: n/a
Hello,

I have a ListBox filled with many lines of simply text
I want to make few lines be a LinkLabel

How can I do this

Thanks
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Add a linklabel control to the controls collection of the listbox:

Dim olink As New LinkLabel
olink.Text = "Google"
olink.Links.Add(0, Len(olink.Text), "www.google.com")
ListBox1.Controls.Add(olink)

Add a handler for the LinkClicked event of the LinkLabel and add code to
navigate to the URL that's specified by the LinkLabel:

AddHandler olink.LinkClicked, AddressOf LinkClicked

Private Sub LinkClicked(ByVal sender As Object, _
ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs )
System.Diagnostics.Process.Start(CStr(e.Link.LinkD ata))
End Sub

hope that helps..
Imran.
Hello,

I have a ListBox filled with many lines of simply text I want to make
few lines be a LinkLabel

How can I do this

Thanks


Nov 21 '05 #2

P: n/a
"vince" <vi***@discussions.microsoft.com> schrieb:
I have a ListBox filled with many lines of simply text
I want to make few lines be a LinkLabel


You can set the listbox' 'DrawMode' to 'OwnerDraw*' and then draw the items
accordingly in the 'DrawItem' event.0

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

P: n/a
Thanks Imran
You have resolve my problem

Vince

"Imran Koradia" wrote:
Add a linklabel control to the controls collection of the listbox:

Dim olink As New LinkLabel
olink.Text = "Google"
olink.Links.Add(0, Len(olink.Text), "www.google.com")
ListBox1.Controls.Add(olink)

Add a handler for the LinkClicked event of the LinkLabel and add code to
navigate to the URL that's specified by the LinkLabel:

AddHandler olink.LinkClicked, AddressOf LinkClicked

Private Sub LinkClicked(ByVal sender As Object, _
ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs )
System.Diagnostics.Process.Start(CStr(e.Link.LinkD ata))
End Sub

hope that helps..
Imran.
Hello,

I have a ListBox filled with many lines of simply text I want to make
few lines be a LinkLabel

How can I do this

Thanks


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.