Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 935811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:12:54+00:00 2026-05-15T21:12:54+00:00

I am developing a windows based application in .net. I have two forms. Form2

  • 0

I am developing a windows based application in .net.

I have two forms. Form2 is instantiated and displayed when an event occurs in form1.

public partial class Form1 : Form
{
    ...
    private void button1_Click(object sender, EventArgs e)
    {
       .... 
    }
    public void button2_Click(object sender, EventArgs e)   
    {
      Form2.parent = this;

      Form2 f2 = new Form2();

      f2.show();
    }

}

public partial class Form2 : Form
{
    ...
    public static Form parent;
    private void button3_Click(object sender, EventArgs e)
    {
       .... //want to call Form1's button1_Click() function.
    }

}

Now in Form2’s button3_Click() function I want to call Form1’s button1_Click() method.

I tried

parent.button1_Click(button3,null);

but this is not working.

please help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:12:55+00:00Added an answer on May 15, 2026 at 9:12 pm

    You need to declare parent as being of type Form1 rather than Form.

    I would personally put it in the constructor though, rather than having it as a public static variable:

    public partial class Form1 : Form
    {
        public void button2_Click(object sender, EventArgs e)   
        {
          Form2 f2 = new Form2(this);
          f2.show();
        }
    }
    
    ...
    
    public partial class Form2 : Form
    {
        Form1 parent;
    
        public Form2(Form1 parent)
        {
            this.parent = new parent;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We developing an Application using .NET Framework 4.0 (C#) windows forms based application. Now,
I have a tab-based application for windows, which I am developing by myself. I
I'm developing a Windows Forms Application in Visual Basic .NET with Visual Studio 2008.
We are developing C#.Net 4.0 Windows form based application using Microsoft.Office.Interop.Word reference. Now I
We are developing C# .net 4.0 Windows Form Based Application. Here, User Will enter
I'm developing a Swing-based Java application in Eclipse on Windows XP. I have a
I am Developing Windows Form Application in .Net, I want to insert selected rows
I am developing windows CE 6.0 for VIA board. I have a MFC application
I have worked with window based application in .net. But I want to learn
I am developing a windows desktop client/server application in .NET where the client application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.