Change the status of a panel within a class

Jun 21 2011 3:00 AM

I am having a windows form application which contains a panel. I want to access that panel when I call a specific method in a class file and change the status of the panel to visible.

I tried to create an object of the form within the method and change the status. It does not gives an error, but it does not display the panel.


public class Compare
{
  public void Comp(a,b)
  {
     form1 f=new form1();

     if(a<b)
        f.panel1.visible=true;
     else if(a>b)
        f.panel2.visible=true;
     else
        f.panel3.visible=true;
  }
}

Can anyone tell me how to do this in C#?

Thanks in advance.

 


Answers (1)