I have some webBrowsers on my C# application, infact I have 10. webBrowser0, webBrowser1, webBrowser2 and so on..
Anyways, I’m performing a loop to count each screen to place a webBrowser on each screen I have, all this is done easily, but in my loop, if have something like this.
for (index = 0; index <= totalScreens; index++)
{
if (index == 0)
{
webBrowser0.Width = x;
webBrowser0.Height = x;
}
if (index == 1)
{
webBrowser1.Width = x;
webBrowser1.Height = x;
}
}
As you cansee, I’m doubling up on code quite a lot, so if I could refer to webBrowser{index} that would be perfect but that of course isn’t working.
You could define an array
and use
browsers[index]in your loop.