更新时间:2023-02-11 08:52:59
首先,请不要使用转到 - 实际上忘记它存在了几年,到那时你应该更好地了解何时适合使用它。
相反,尝试这样的事情:
First off, don't use Goto - in fact forget it exists for a couple of years, by which time you should have a better idea of when it is appropriate to use it.
Instead, try something like this:
private void button1_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Enter more data?", "Data Saved", MessageBoxButtons.YesNo) == DialogResult.No)
{
Close();
}
}
如果用户不想输入更多数据,那将关闭您的表单。
Which closes your form if the user doesn't want to enter more data.