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 8987569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:49:40+00:00 2026-06-15T21:49:40+00:00

This is my second question for the same problem but made this example much

  • 0

This is my second question for the same problem but made this example much simpler for me to understand your answers better.

I’m getting “No overload for method ‘form2’ takes ‘0’ arguments”

Button on form1 takes you to form2 and also takes the value of the textbox over. Form2 displays value of textbox in label. Then I have a back button on form2 that takes you back to form1.

Im getting the error when I use the below code the second time:

private void button1_Click(object sender, EventArgs e)
{
    Form2 frm2 = new Form2();
    frm2.Show();
    this.Hide();
}

Here is all the code for this example:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        Form2 frm2 = new Form2(textBox1.Text);
        frm2.Show();
        this.Hide();
    }
}

public partial class Form2 : Form
{
    public string txtbox;

    public Form2(string txtbox)
    {
        InitializeComponent();
        this.txtbox = txtbox;
    }
    private void Form2_Load(object sender, EventArgs e)
    {
        label1.Text = txtbox;
    }
    private void button1_Click(object sender, EventArgs e)
    {
        Form2 frm2 = new Form2();
        frm2.Show();
        this.Hide();
    }
}

Can someone please explain this and how to get this right. I’m still noob so please be detailed.

  • 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-06-15T21:49:41+00:00Added an answer on June 15, 2026 at 9:49 pm

    You don’t have a default constructor in Form2, your only available constructor in Form2 requires a string parameter.

    You may define a parameterless constructor in your form.

    public partial class Form2 : Form
    {
        public string txtbox;
        public Form2() // a new parameterless constructor
        {
            InitializeComponent();
        }
    

    The other option is to utalize the existing constructor and pass it some string value, in your button click event.

    Form2 frm2 = new Form2("somestring");// can be empty string as well
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my second question about clicking buttons in JavaScript but this one I'm
This is my second attempt at this question . I made a mess of
It's my second question of the day related to the same problem, so I
This is my second question on Bamboo ( My First One ). My understanding
I hope it's the heat, this is the second question today and it's one
So, my second question based off of this application I'm teaching myself Objective C
this is the second game that I'm having issues with in the same area...
I need your help. I have made a really clean and simple example to
This is my second question, and I’m hoping to resolve an issue that I
I have asked this question in cstheory too I have a form distribution problem.

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.