CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Threaded View

  1. #1
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    [RESOLVED] how to set the text property on a checkedlistbox collection

    I had read on pages like this

    that when adding objects to a CheckedListBox, it takes the .ToString() function of each added object as the text string.

    I added instances of SortedDictionary as this

    Code:
    Friend Class MySortedDictionary
        inherits SortedDictionary(Of string, something)
    
        Public Overrides Function ToString() as string
            return "I want to show this"
        end Function
    end Class
    ...
    CheckedListBox1.Items.Add(new MySortedDictionary)
    ...
    So, lets say, I want the text shown near each checkbox to be "I want to show this"
    But instead, I are seeing
    Code:
    (Collection)
    How is the right way?

    (the overriden function ToString() as is never called)
    Last edited by Marraco; February 2nd, 2009 at 07:19 PM. Reason: fixed bugs/misspellings
    [Vb.NET 2008 (ex Express)]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured