PC Review


Reply
Thread Tools Rate Thread

How to add LinkLabel in a ListBox

 
 
=?Utf-8?B?dmluY2U=?=
Guest
Posts: n/a
 
      8th Mar 2005
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
 
Reply With Quote
 
 
 
 
Imran Koradia
Guest
Posts: n/a
 
      8th Mar 2005
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.LinkData))
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
>




 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      8th Mar 2005
"vince" <(E-Mail Removed)> 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/>

 
Reply With Quote
 
=?Utf-8?B?dmluY2U=?=
Guest
Posts: n/a
 
      8th Mar 2005
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.LinkData))
> 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
> >

>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linklabel Horváth Szilárd Microsoft C# .NET 2 22nd Dec 2008 02:36 PM
Linklabel Rinaldo Microsoft C# .NET 1 26th Nov 2007 06:06 PM
LinkLabel and Datagrid Xavier Microsoft VB .NET 0 15th Mar 2005 05:43 PM
LinkLabel =?Utf-8?B?dG90YQ==?= Microsoft C# .NET 1 16th Jan 2005 01:01 PM
LinkLabel Nick Microsoft Dot NET Compact Framework 4 12th Nov 2003 03:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:54 PM.