using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;namespace WindowsApplication1
{
    public delegate void GetString(string name);
    public partial class Form1 : Form
    {
        private Thread thread;
        public Form1()
        {
            InitializeComponent();
            thread = new Thread(new ThreadStart(Start));
        }
        private void Start()
        {
            GetText("textBox1");
        }
        private void GetText(string name)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new GetString(GetText), new object[] {name});
            }
            else
            {
                foreach(Control con in Controls)
                {
                    if (con.Name == name)
                    {
                        TextBox box = con as TextBox;
                        MessageBox.Show(box.Text);
                    }
                }
                            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            thread.Start();
        }
    }
}封送