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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:22:30+00:00 2026-06-01T22:22:30+00:00

In (Form1) i have a setting button, when i click on it a new

  • 0

In (Form1) i have a setting button, when i click on it a new form ( Form2 ) is shown, using these lines of code :

private void b7_Click(object sender, EventArgs e)
{
    Form3 frm = new Form3();
    frm.Show();

}

In form3, i have 6 text boxes, and two button, Save and Cancel.

enter image description here

What i’m trying to do is to provide this form to the user so he types the neccessary data into the form, then he click the Save Settings button. In Form1, i want to access to these text boxes to get their current values ( when user clicked save settings ). I tried to add a Form4 and named it ( MiddleForm), i added 6 text boxes to it, and in Form3 (The form in the image above) i wrote these line :

private void button2_Click(object sender, EventArgs e)
{
    MiddleForm mf = new MiddleForm();
    mf.textBox1.Text = keywrd1.Text;
    mf.textBox2.Text = keywrd2.Text;
    mf.textBox3.Text = keywrd3.Text;
    mf.textBox4.Text = keywrd4.Text;
    mf.textBox5.Text = keywrd5.Text;

    mf.textBox1.Text = thelink.Text;

    Close();


}

then i tried to access the values passed to the MiddleForm from Form1 (The form where i need to use the textboxes values), in Form1, i wrote these lines (for debug purposes only)

MiddleForm mf = new MiddleForm();

MessageBox.Show(mf.textBox1.Text); // to see whether there is something 

Unfortunately, it seems that nothing is passed to mf.TextBox1

enter image description here

How can i call the current values (Saved using save settings button) of Form3 From Form1 in order to use them in the rest of code.

Any help please on getting this to work ?

  • 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-01T22:22:31+00:00Added an answer on June 1, 2026 at 10:22 pm

    Make public properties in Form3 like this

    public string[] Keys
    {
        get
        {
            return new string[] { tbKey1.Text, tbKey2.Text, tbKey3.Text,
                                  tbKey4.Text, tbKey5.Text};
        }
    }
    
    public string Link { get { return tbLink.Text; } }
    

    From Form1 you can access these properties like this

    Form3 frm = new Form3();
    if (frm.ShowDialog() == DialogResult.OK) {
        string[] keys = frm.Keys; 
        string link = frm.Link; 
    }
    

    Note: It is important that you use ShowDialog and not Show, since Show does not wait for the other form to close. Also, when “Save settings” is clicked in Form3, set the dialog result

    DialogResult = DialogResult.OK;
    Close();
    

    so that you can check it in Form1 as shown above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a segment of code I have for setting the masterpassword: private void
I have an AJAX form I'm setting up, using an <input type=button> with a
I have a form1.cs and in that form I have a panel1, in the
In the top Form1 level I have: List<float> cyclicSelectedIndex = new List<float>(2); int currentCyclicIndex;
I have a form (Form1) that has a NotifyIcon on it. I have another
I have three forms: Form1 (Which is Mdi) Form2 (child of mdi) Form3 (child
I have 3 forms in my project form1 , form2 , form3 and it
i have a prioblem with a callback because my Form1 open Form2 and send
I have a form with 3 textboxes and 1 button. textbox1 has tab index
I have a form that is displayed, not by ShowDialog, but by setting its

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.