[Solved] Call form method from another object method


Declare a class scoped variable and in the load event/constructor call you reference your main form. Not the best practice but you dont provide too much information about what you are trying to accomplish..

    public static Form1 form;

    public class Foo
    {
        public void FooVoid()
        {
            //Form1.FormVoid();

            //Then you have a reference to your Form1 and can call the method like this
            Form1.form.FormVoid()
        }
    }

    public void FormVoid()
    {

    }

    public Program()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        form = this;
    }

solved Call form method from another object method