Resolved Listbox listing items like: ListViewItem: {myname}

Jens Boedt

Member
Joined
Dec 2, 2020
Messages
7
Programming Experience
Beginner
Hello,

Why is my ListBox listing my items like:
ListViewItem: {myname}
instead of:
myname
 
Solution
What type does a listbox item expect to be passed to it?

An object, right?

So why would you expect it to be displayed any other way when you are passing in a ListViewItem and not calling .Text on that items property to add the value as text?
I am referring to line 15 of your code. And in future, post your code on the forums wrapped in appropriate code tags. Otherwise, you force us to rewrite your code from scratch. So try harder to make it easier for us to help you by doing so.
No you didn't have to change controls. It would have worked if you done as I instructed. This is the very reason not to post code as a screenshot.

All you needed to do is add the .Text property onto your original code where the Koker item gets added.

Where you are adding Koker item. Call .Text on that Koker item and It will display correctly without changing your controls. Leave it as you had it, and add the text property as instructed.

What on earth is the point in asking for help on a public forum if you are going to defy the instructions of a working example given to you?
 
No you didn't have to change controls. It would have worked if you done as I instructed. This is the very reason not to post code as a screenshot.

All you needed to do is add the .Text property onto your original code where the Koker item gets added.

Where you are adding Koker item. Call .Text on that Koker item and It will display correctly without changing your controls. Leave it as you had it, and add the text property as instructed.

What on earth is the point in asking for help on a public forum if you are going to defy the instructions of a working example given to you?
As i said in #8: koker is not the problem. It's the listbox with geval. Here i already added the .Text property...
 
Your gevallenList is also adding the listviewitem without a text property. It doesn't matter whether you set the text property previously before adding it. Where you are adding it, you are not adding the text property to the item when it's being added to the control, but instead, you are adding the whole object instead. This is normal to see {SomeValue} in curly brackets when you add an object of this type, because you are not calling on the text property upon adding it. There was no need to change any of your code.

Next time you post a topic, please remember to post your code in code tags, and it would also be helpful if you spend the time telling us what the names of what your controls are.
 
Your gevallenList is also adding the listviewitem without a text property. It doesn't matter whether you set the text property previously before adding it. Where you are adding it, you are not adding the text property to the item when it's being added to the control, but instead, you are adding the whole object instead. This is normal to see {SomeValue} in curly brackets when you add an object of this type, because you are not calling on the text property upon adding it. There was no need to change any of your code.

Next time you post a topic, please remember to post your code in code tags, and it would also be helpful if you spend the time telling us what the names of what your controls are.
I'll remember. Thanks for your time!
 

Latest posts

Back
Top Bottom