我通过工具条打开一个附加表单以输入主窗体中需要的用户名(并在主窗体中声明为字符串)
主窗体代码:
private void toolStripButton6_Click(object sender, EventArgs e)
{
using (Form frm = new Form3())
{
frm.FormBorderStyle = FormBorderStyle.FixedDialog;
frm.StartPosition = FormStartPosition.CenterParent;
if (frm.ShowDialog() == DialogResult.OK)
{
Username = frm.ReturnValue1;
}
}
}
Form3代码:
public string ReturnValue1 {
get
{
return textBox1.Text;
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
C# 告诉我没有 frm.ReturnValue1 :(