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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:42:14+00:00 2026-05-15T20:42:14+00:00

The case is this, I have two different forms from the same solution/project. What

  • 0

The case is this, I have two different forms from the same solution/project. What I need to do is to extract the value of a label in Form A and load it into Form B. As much as possible, I am staying away from using this code since it will only conflict my whole program:

FormB myForm = new FromB(label.Text);
myForm.ShowDialog();

What I am trying right now is a class with a property of get and set for the value I wanted to pass. However, whenever I access the get method from FormB, it returns a blank value.

I hope somebody can help me with this. Any other ways to do this is extremely appreciated. 🙂

    public class Miscellaneous
    {
       string my_id;

       public void SetID(string id)
       {
           my_id = id;
       }

       public string GetID()
       {
           return my_id;
       }
     }
  • 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-15T20:42:15+00:00Added an answer on May 15, 2026 at 8:42 pm

    You could do something like this:

    Child form

    public string YourText { get; set; }
    
    public TestForm()
    {
        InitializeComponent();
    }
    
    public void UpdateValues()
    {
        someLabel.Text = YourText;
    }
    

    Initiate it

    var child = new TestForm {YourText = someTextBox.Text};
    
    child.UpdateValues();
    
    child.ShowDialog();
    

    With this approach you don’t have to change the Constructor, you could also add another constructor.

    The reason for them being empty is that the properties are set after the constructor, you could Also do someting like this to add a bit of logic to your getters and setters, However, I would consider not affecting UI on properties!

    private string _yourText = string.Empty;
    public string YourText
    {
        get
        {
            return _yourText;
        }
        set 
        { 
            _yourText = value;
            UpdateValues(); 
        }
    }
    

    In this case, the UI will be updated automaticly when you set the property.

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

Sidebar

Related Questions

Imagine this case where I have an object that I need to check a
I have some code that looks like this: someFunc(value) { switch(value){ case 1: case
i have this block of xslt if-else case and was wondering if there's a
Scenario: I have a document I created using LaTeX (my resume in this case),
Suppose that I have a Java program within an IDE (Eclipse in this case).
Take a very simple case as an example, say I have this URL: http://www.example.com/65167.html
I think in this case there is no need to declare a public constructor
First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built
Consider this case: dll = LoadDLL() dll->do() ... void do() { char *a =
I ran across this case of UnboundLocalError recently, which seems strange: import pprint def

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.