我想将我的 TextBox 的值从 Form1 传递到 Form2。
并出现此消息。
"Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before calling showDialog."
这是我的代码Form1
:
private void btnAddReceipt_Click(object sender, EventArgs e)
{
this.Hide();
using (var Ticket = new frmCustomerTicket())
{
Ticket.CustomerID = txtCustNo.Text;
ShowDialog();
}
}
这是我在 Form2 中的代码
public string CustomerID { get; set; }
private void frmCustomerTicket_Load(object sender, EventArgs e)
{
txtCustID.Text = CustomerID;
}