Ahmad Reza
Ahmad Reza

Reputation: 913

Show Button from Form2 in Form1 C#

I Have two form and both contain a button. And I want to show button1 from Form2 in Form1 But I can't do that !!
I tried everything but no success
Can anyone please help me ??

Upvotes: 0

Views: 142

Answers (1)

mohsen
mohsen

Reputation: 1806

Form1

public class Form1:Form
{
    public Form2 MyFrom { get; set; }
    public void From_Load ( object sender ,EventArgs e)
    {
        MyForm = new Form2();
        MyForm.Show();
    }
    public void btn_Click ( object sender ,EventArgs e)
    {
        MyForm.btn.Visible = true;
    }
}

Upvotes: 1

Related Questions