4

I have an object I created in C#, lets call it "listBoxCustom".

I want to store listBoxCustom in my listbox object, and i have a number of listBoxCustom objects.

I want to display a given name that I set for each object in the listbox, but as of right now it is displaying "myProject.listBoxCustom" in the nodes of the listbox, for as many items as I have added.

What do I need to do such that it will display the correct name that I want? I am assuming I need to create a certain property of my object and the listbox will by default try and access this, I am just not sure what it is.

Please let me know if you need additional detail, and thank you in advance.

1

1 Answer 1

9

Simply override ToString method in your listBoxCustom class.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.