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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:16:02+00:00 2026-06-16T01:16:02+00:00

Still new to C# .NET so simple (with explanation) is preferred. :) I have

  • 0

Still new to C# .NET so simple (with explanation) is preferred. 🙂 I have a Windows form with a few textboxes. I want to be able to read in the contents of these textboxes,in a separate file. I’ve seen articles (also here on stackoverflow) which cover similar problems, but don’t work in my case.
The data I want is to be found in textboxes in Form1.
Where I want this data to go is -> myOtherCS, where it will be used in a method (Savedoc).

In Form1.cs I have:

private myOtherCS allOtherMethods;
public static string myText= "";
public static string mytitle = "";

public Form1()
{
    InitializeComponent();            
    allOtherMethods = new myOtherCS();
}
/* I would like the myText to be filled with the contents of Textbox1
 *  and mytitle to be filled with contents of Textbox2. Ideally when the
 * Textboxes have been changed.  */

private void TextBox1_TextChanged(object sender, EventArgs e)
{
     myText = Textbox1.Text;
}

private void TextBox2_TextChanged(object sender, EventArgs e)
{
     myTitle = Textbox2.Text;
}

In myOtherCS file I want to be able to use these values within a different method. So first probably “get” and “set”-ing them.
I’ve tried a lot of things but here is one.. to get the idea from.. I do know that you have to change things in both files, and have, but this is to get the idea.

public class GetTextBoxes
{
    private string title;
    private string text;

    public string Title
    {
        get { return title; }
        set { title = value; }
    }

    public string Text
    {
        get { return text; }
        set { text = value; }
    }
}

public void SaveDoc()
{ 
    GetTextBoxes.title;
    GetTextBoxes.text;
}

This is PSEUDOcode as of yet, to try to show what I want to do. I’ve tried many things, if someone knows how to do this, I would very much appreciate it! Thanks in advance

  • 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-16T01:16:04+00:00Added an answer on June 16, 2026 at 1:16 am

    You have said that your form is calling methods in another class when you click a button, and those other methods need to use the current value of your text boxes when performing their calculations. The proper way to deal with that is to just have those other methods accept two string parameters and to pass the textbox’s Text value when you call those methods.

    Doing that will allow you to remove the text changed handlers and the public static fields. It will ensure that the information isn’t exposed to everything, when really only these two classes need to have access to it, and it will make your program easier to maintain going forward.

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

Sidebar

Related Questions

Question ONE: I'm still pretty new to .net, but have used Visual Studio for
still new to XML parsing with the iphone so i have a few questions.
I have read about the Tuples provided with the coming-out of the new .NET
I'm new to ASP.NET and C# and I want to create simple webapp. How
So, I'm making an ASP.NET page in C#. I have a very simple form
I still new using Asp.net with vb.net Protected Sub login_Click(ByVal sender As Object, ByVal
I am still new into Codeigniter framework. Today I read about Database Caching http://codeigniter.com/user_guide/database/caching.html
I am still new to LINQ, and I have wrestled with a query for
I'm converting a classic ASP page to ASP.NET MVC 2. I have a simple
I have various simple ASP.NET MVC views for CRUD operations which work fine on

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.