❔ How to display a class property in a list box ?
I am working on a recipe book software for uni and I have troubles displaying a class property in a listbox. I have an array of classes and I need to display the name property of the class in a listbox. I figured something is wrong with my display() method since the values are correctly retrieved (I checked it with message box). Can anyone tell me what I am doing wrong here ?
8 Replies
It's adding the value of showing and not Name
Also since the methods are only using the index to retrieve the recipe, you can change the parameters to take a single recipe instead and index the array inside the calls 🙂
sorry I forgot to add more context, basically the class display is supposed to be called after a name of recipe got input by the user, it's called from the method addRecipe located in the class Recipe
So what is the expected result?
to add the name property of the class Recipe to a listbox
this property is a string
and the class instance recipe is located in an array of class instances "recipes"
how is addRecipe called?
it's a chain triggered by clicking the button
Hard to tell without the full code. Use breakpoints to check the values at runtime and see where's it's different than expected.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.