考虑用静态的FORM或TEXTBOX来存储
在Form1的LOAD时,初始化
CLOSED时释放

解决方案 »

  1.   

    在Form1中把textBox1声明为static的public static System.Windows.Forms.TextBox textBox1;然后在子窗体中就可以通过orm1.textBox1来访问了比如用如下代码给textBox1赋值Form1.textBox1.Text = "test";
      

  2.   

    回楼上  我在其他的窗体里  按你的方法做
    报错 Form1不包含对textBox1的定义
      

  3.   

    获取值的话用(TextBox)form1.FindControl("textBox1")可以实现。但是要重写值不知道这样能不能实现
      

  4.   

    -_-#,一定要说得那么详细才可以吗在Form1.Disigner.cs里把原来的
    private System.Windows.Forms.TextBox textBox1;
    改为
    public static System.Windows.Forms.TextBox textBox1;在InitializeComponent()里把
    this.textBox1 = new System.Windows.Forms.TextBox();
    改为
    textBox1 = new System.Windows.Forms.TextBox();
    相应的textBox1的属性初始化部分也要把this.去掉
    然后就可以在Form2中这样调用textBox1了
    Form1.textBox1.Text = "test";
      

  5.   

    最简单的办法是在构造函数中传递本窗体的引用请参考:
    请参考//Form1.cs
    public partial class Form1 : Form
    {
        public string MyText
        {
            get 
            {
                return textBox1.Text;
            }
            set
            {
                textBox1.Text = value;
            }
        }
        public Form1()
        {
            InitializeComponent();
        }    private void button1_Click(object sender, EventArgs e)
        {
            Form2 frm = new Form2(this);
            frm.ShowDialog();
        }
    }//Form2.cs
    public partial class Form2 : Form
    {
        Form1 form1;
        public Form2()
        {
            InitializeComponent();
        }
        public Form2(Form1 f)
        {
            InitializeComponent();
            this.form1 = f;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            form1.MyText = "abc";
        }
    }
      

  6.   

    应该就是Public 变量的问题了吧,,解决方法有多种申明一个public 的过程,或是把控件申明为public的lxcnn(过客) 
    amandag(高歌) 
    他们的办法应该都很好
      

  7.   

    to:lxcnn(过客)   按照你说的又改了一次  还是同样的错误
    amandag(高歌)    很多窗体都需要调用这个控件  这样做的话是不是会很麻烦
      

  8.   

    参考代码Form1using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        public static string fortxt;
                    private void Form1_Load(object sender, EventArgs e)
            {
                fortxt = textBox1.Text;
            }Form2使用textBox1代码,我用的是label1控件显示
     label1.Text = Form1.fortxt.ToString();Form3如此类退......