I got this error.I tried to create an instance of control but didn't work. Can somebody help me?
Error CS0120 An object reference is required for the non-static field, method, or property 'Control.Controls'
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
static void Main(string[] args)
{
foreach (var button in Form1.Controls.OfType<Button>())
{
}
}
}