使用goto语句的问题 [英] problem in using goto statement
本文介绍了使用goto语句的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们。
i在活动内外使用goto语句时遇到问题;
i在我的表单中有一个按钮。在此表单的单击事件中,我有一个消息框,是和否
按钮。我想如果用户点击是,他可以在表格文本框中输入一些信息再次
点击按钮。我在点击事件之前使用了goto语句,但它不起作用。我必须做什么?
请帮助。
hi friends.
i have problem in using goto statement in the inside and outside of an event;
i have a button in my form. in the click event of this form i have a messagebox with yes and no
buttons. i want if user click yes, he can enter some information in forms textboxes and again
click the button. i used goto statement before click event but it does not work. what i must do?
please help.
推荐答案
首先,请不要使用转到 - 实际上忘记它存在了几年,到那时你应该更好地了解何时适合使用它。
相反,尝试这样的事情:
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.
这篇关于使用goto语句的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文