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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:11:34+00:00 2026-06-17T12:11:34+00:00

Basically when a user enters data into a textfield on Form2 , I want

  • 0

Basically when a user enters data into a textfield on Form2, I want that data to be stored into a variable then when users selects the button enter, Form2 will hide and Form1 will appear. I then want Form1 to display the data entered in the textfield from Form2 in a new textfield.

This is my attempt, but it doesn’t work

On Form 2…

public string Player1 {get; set;}

private void pvpPlay_Click(object sender, EventArgs e)
    {

        Player1 = txtPlayer1.Text;
        Form1 op = new Form1();
        op.Show();
        this.Hide();

    }

Then on Form1 to call this I put…

Form2 f = new Form2();
txtTest.Text = f.Player1;

But it doesn’t work. Hopefully someone knows the answer.

  • 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-17T12:11:35+00:00Added an answer on June 17, 2026 at 12:11 pm

    I would prefer the using of a simple Callback function like this:

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    
        public String SomeProperty { get; set; }
    
        private void OpenFormButton_Click(object sender, EventArgs e)
        {
            var secondForm = new Form2()
            {
                GetSomeProperty = () => { return SomeProperty ;};
            };
            this.Hide(); //The best way to hide!
            secondForm.Show();
        }
    
        private void Form1_Load(object sender, EventArgs e)
        {
            SomeProperty = "HELLO WORLD";
        }
    }
    
    
    
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
    
        public Func<string> GetSomeProperty
        {
            get;
            set;
        }
    
        private void Form2_Load(object sender, EventArgs e)
        {
            MessageBox.Show(GetSomeProperty.Invoke());
        }
    }
    

    Everytime you call GetSomeProperty.Invoke(); the Func will call the get accessor and return it from the first Form

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

Sidebar

Related Questions

As indicated in the code. The user enters data into one of the 6
Basically, I do not want the user to enter '0' (zero) as the first
I want to make a site where there user can basically navigate the web
I basically need to get user input: gets.chomp(input?) And then to convert the given
Basically I want to check what url the user is on and compare it
Basically I want to check the extended permissions the user has granted my app.
Basically I have a single page site that scrolls when the user clicks on
I have a situation that users access remote MySQL server in C# application. Basically,
I need to store an array of user created objects (a user enters data
I'm trying to make a notecard application. Basically, the user enters in a term

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.