The other day, I asked how to create a message box in your class, but one of the answers stated that was it wasn’t the correct approach. I understand that this is because it really defeats the point of a class.
My program reads word by word from a string file, and checks if each word is in the database. I want to put every word not found into a ListBox on the form, which can have multiple selections.
How do I send that data back to the form each time a new word is found?
I suggest you make a method something like this:
Then call that method from your form, and add each string it returns to your box.
(If you’re not familiar with
IEnumerable, don’t worry — it’s just a interface that defines a sequence of things, like an array or a list. You could pass an array of strings instead, but it would be a little less precise.)