As Andrew Hare suggested in his answer:
Create a field to store all the ListBox instances and then change the constructor to accept an arbitrary number of them.
I tried the following
class scaner
{
readonly IEnumerable<ListBox> listBoxes;
public IEnumerable<ListBox> ListBoxes
{
get { return this.listBoxes; }
}
public scaner(params ListBox[] listBoxes)
{
this.listBoxes = listBoxes;
}
}
This will allow you to do this:
scaner Comp = new scaner(listBox1, listBox2);
How can i access listbox1?
In class scaner i'm trying to call this.listBoxes.
(I need to call the listbox1 in scaner class.How can i do/call it?
Thanks for answers.