1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: C# changing what a listbox displays for a class

Discussion in 'Software Development' started by cpscdave, Dec 17, 2011.

Thread Status:
Not open for further replies.
  1. cpscdave

    cpscdave Thread Starter

    Joined:
    Feb 25, 2004
    Messages:
    444
    Hi all,

    Perhaps I'm going about this the wrong way,
    I'm keeping a collection of a custom class which I want displayed inside of a listbox,
    when I set the listbox's data source to this listbox it just displays the class name a bunch of times.

    How can I change what the listbox displays for this class?

    So instead of the list box displaying <class name>
    I'd like to it display a string, built from values contained inside the class?

    Hope that makes sense

    Thanks for helping :)
     
  2. cpscdave

    cpscdave Thread Starter

    Joined:
    Feb 25, 2004
    Messages:
    444
    bah nvm, as par for the course as soon as I post seeking help I figured it out.

    I had built a custom toString function in the class, but you need to include the override keyword :)
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1031623

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice