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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:17:36+00:00 2026-05-29T04:17:36+00:00

I’m using MainWindow and Settings. MainWindow is the startup window from which I can

  • 0

I’m using MainWindow and Settings. MainWindow is the startup window from which I can open Settings. I’m trying to share some properties between both windows. Right now, I have the public properties declared in Settings:

public partial class Settings : Form
{
    private string property1

    public Settings()
    {
        InitializeComponent();
        this.changeSettings();
    }

    public string property1
    {
        get { return property1; }
        set { property1 = value; }
    }

    public void changeSettings()
    {
        textbox.Text = property1;
    }
}

I can create an instance of Settings in MainWindow and change the properties from there:

public partial class Mainwindow : Form
{
    private Settings settings;

    public MainWindow()
    {
        InitializeComponent();
        settings = new Settings();
        this.changeSettings();
    }

    private void changeSettings()
    {
         settings.property1 = "value";
         textbox.Text = settings.property1;
    }

    private void openSettings_Click(object sender, EventArgs e)
    {
        settings.ShowDialog();            
    }
}

Say, I want to change the contents of the textboxes in both forms. For MainWindow this works, i.e. I can store the value in the property and access it again. However, I open up Settings and try to change its textbox, the property is empty!
What could explain this?

  • 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-29T04:17:37+00:00Added an answer on May 29, 2026 at 4:17 am

    The flaw is in Settings.property1, it doesn’t update the text box that displays its value. A simple solution is:

    public string property1
    {
        get { return textBox1.Text; }
        set { textBox1.Text = value; }
    }
    

    You’ll also need to update your MainWindow’s text box after displaying the dialog:

    private void openSettings_Click(object sender, EventArgs e)
    {
        settings.property1 = textbox.Text;
        if (settings.ShowDialog() == DialogResult.OK) {
           textbox.Text = settings.property1;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small

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.