hello! i have a class that has several methods working with panels and a panel array which contains panels. when i use them in form1 like this:

PanelClass panelfield = new PanelClass();
panelfield.drawField();

it works nicely and draws my field of panels. every panel has a mouse click event that changes it's color. however, when i try to get a new field by pressing a button:

private void button1_Click(object sender, EventArgs e)
{
panelfield.resetPanels();
panelfield.drawField();
}

which contains

for (int i = 0; i < 5; i++)
{
panelArray[i].BackColor = Color.White;
}

it does not work, same newly changed panel colors are up. i have also tried to change other class variable values like this ant it does not works. how do i reset my panels? thanks.

>how do i reset my panels? thanks.

Do you get any errors? Please post complete source code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.