if the button is a direct child of the form:
bool isButtonOnForm = this.Controls.Contains(button6);
otherwise you will need a recursive method:
public bool IsButtonFound(Control ctl, Button btn)
{
if (!ctl.HasChildren){return false;}
foreach (Control child in ctl.Controls)
{
if (child == btn){ return true;}
if (IsButtonFound(child, btn)){ return true;}
}
return false;
}
this looks walks the control hierarchy until it finds the button (at which point all recursive calls return true all the way up to the root call) or until it runs out of controls