C# WINFORM 两个窗体的问题....

来源:百度知道 编辑:UC知道 时间:2024/07/05 15:42:39
主窗体a有按钮ba,点下ba,窗体b.ShowDialog();
窗体b里有几个TextBox,随便输入一些字,比如"abc","234",关闭窗体b.返回主窗体a,再点下ba.....

如何实现..这次弹出窗体b里的TextBox里的内容跟上次关闭的时候的内容一样.....

窗体a 代码:
using 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 static string texta = "", textb = "";
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
Form2 ff = new Form2(texta, textb);
ff.ShowDialog();
}
}
}

窗体b 代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;