C# listbox,params
Posted
by Oyeme
on Stack Overflow
See other posts from Stack Overflow
or by Oyeme
Published on 2010-04-30T13:25:51Z
Indexed on
2010/04/30
13:37 UTC
Read the original article
Hit count: 282
c#
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: by
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.
© Stack Overflow or respective owner