There is a button on the form when you click on it, the btn_Click event is btn_Click , in which there is a function someFunc with the param parameter, how can you pass this parameter?

 private void btn_Click(object sender, EventArgs e) { someFunc(param); } 
  • Make param a form field. - Alexander Petrov

2 answers 2

 btn.Tag = param; private void btn_Click(object sender, EventArgs e) { someFunc(((Control)sender).Tag); } 

    For example, you can:

     string param = "fdgdfgd"; //допустим ваш параметр string // public string Param { get; set; } или так private void btn_Click(object sender, EventArgs e) { someFunc(param); }