RadListBox values

2 posts, 0 answers
  1. R
    R avatar
    8 posts
    Member since:
    Apr 2008

    Posted 13 Jun 2008 Link to this post

    Hi. I need to store two values in each of the items of the radlistbox. I'm trying this:

        Class MyItem 
            Inherits Telerik.WinControls.RadItem 
            Public MyShowText As String 
            Public MyStrng As String 
            Sub New(ByVal ShowText As StringByVal Strng As String
                MyShowText = ShowText 
                MyStrng = Strng 
                Me.Text = MyShowText 
            End Sub 
        End Class 
        ListBox1.Items.Add(New MyItem(Path.GetFileName(file_name), file_name)) 
     But the listbox is always empty.

    Can you help me?


  2. Georgi
    Georgi avatar
    212 posts

    Posted 16 Jun 2008 Link to this post

    Hello R,

    Thank you for writing.

    To display both text values in a listbox item, you could use the Text and Description properties of RadListBoxItem. I'm not sure what exactly is the case, but if the values are not textual, you may also create your own descendant of RadListBoxItem which adds additional properties to suit your needs. Alternatively, you can use the Tag property to store any value associated with a particular item.

    Nevertheless, although the RadListBox.Items collection can accept instances of RadItem, direct instantiation of this class is not enough to show anything in the RadListBox. This is due to the architecture of our controls, and the role of the RadItem as an abstract class (please read more about this in our documentation: http://www.telerik.com/help/winforms/architecture_elementsoverview.html ).

    If you have any additional questions, please don't hesitate to write.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
Back to Top