两界面的数据传递是通过定义 static string来确定的。
一端:Form1
public static string str1; // 在Form1 中定义
另一端:Form2
label = Form1.str1; //在Form2 中实现,数据的传递
Form1
:
using System.Threading;
namespace shuju
{
public partial class Form1 : Form
{
Thread thread;
public delegate void hua(); // 定义委托
public static string str1;
public Form1()
{
InitializeComponent();
Form2 frm = new Form2(); //打开另一界面
frm.Show();
thread = new Thread(new ThreadStart(thread_str)); // 创建线程<