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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:51:55+00:00 2026-06-15T17:51:55+00:00

I am making a windows form project and facing difficulty in passing the dynamically

  • 0

I am making a windows form project and facing difficulty in passing the dynamically generated control value to the other form’s normal control value.

My code is:

        int c = 0;
        int p = 0;
        private void button1_Click(object sender, EventArgs e)
        {
            panel1.VerticalScroll.Value = VerticalScroll.Minimum;
           // panel1.HorizontalScroll.Value = HorizontalScroll.Minimum;

            ComboBox txtRun3 = new ComboBox();
            txtRun3.Name = "txtDynamic" + c++ ;
            txtRun3.Location = new Point(30, 18 + (30 * c))
            panel1.Controls.Add(txtRun3);
           txtRun3.Focus();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form4 f4 = new Form4();
        Button bt = sender as Button; 
       ComboBox cb2 = bt.Tag as ComboBox;
        f4.Combo.Text = bt.Text;
         }

I am getting the error:
“Object reference not set to an instance of an object.”

  • 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-15T17:51:57+00:00Added an answer on June 15, 2026 at 5:51 pm

    Provide a public property in the Form4

    public ComboBox Combo
    {
        get
        {
            return this.comboBox1;
        }
        set 
        {
            this.comboBox1 = value;
        }
    }
    

    Then you can access it in this way:

    Form4 f4 = new Form4();
    Button bs = (Button) sender;
    f4.Combo.Text = bs.Text;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a Windows Form project that will search for files in the specified
I'm making a windows form. Here is my current code: I don't have any
I was making an RAII class that takes in a System.Windows.Form control, and sets
I'm making a Windows Form Application with VS 2010. I've added a ProgressBar to
I'm making a windows form application that uses threads, the threads is running and
I'm making a small Windows Form application that contains a lot of grid views.
So I am making a windows form with a separate class for student details
I've got Windows Forms project. There's a textBox on the form, called txt. The
I am making a Windows Form in C#. I have a menustrip (File, Edit,
I am making a Gym management system in windows form ( .Net ) .

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.