I need to pass some parameters to button_click is that possible and if so how can I do it??

if you mean some thing like (int,string,..) you cannot so can you be accurate and till us what exactlly you want to send you how

what I want that if the user click error detection in the button_Click it will check the error array and then print something to the user , so can I pass the error array to this method

you donot have to send it just you need to know "error array " where is it declared? and access it from the button_Click

i couldn't access it

public Form1()
        {
            
            InitializeComponent();
            Inst firstInst = new Inst();
            bool[] ers = firstInst.getErrArr();
           
        


            firstInst.ErrorDetection();
           ErrMsg( firstInst.getErrArr());

            
        }

if the button_click is defined after this can I access the object firstInst in it??

no cause it is scope is the Form1 constructor but you can do this

class Form1
{
Inst firstInst =null;
 public Form1()
 {      
      InitializeComponent();
      firstInst = new Inst();
      bool[] ers = firstInst.getErrArr();
           
      firstInst.ErrorDetection();
      ErrMsg( firstInst.getErrArr());
 }
}

and then use it in button_click as

private void button1_Click(object sender, EventArgs e)
{
      if(firstInst !=null)
      {
         //do something
      }
}

can you explain the second part of your code please

//The button1_Click function that called when button click event happend
private void button1_Click(object sender, EventArgs e)
{
      //check that the variable was initialized
      if(firstInst !=null)
      {
         //Add your code here
         //do something
      }
}

thanks a lot you've been helping me a lot recently I really appreciate it
Thanks again

you are well come all time

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.