如何循环对话结果
Form1 frm = new Form1();
frm1.ShowDialog();
我用它来创建新表单来执行一些操作(不重要),然后在完成表单后,我显示dialogresult以再次打开相同的表单。 问题:我怎样才能继续打开同一个表格? 当对话框结果为“是”时,保持表单打开(如何循环此)? NO 属性打破了循环。 我希望问题很清楚。
Form1 frm = new Form1();
frm1.ShowDialog();
I use this to create new form to do some stuff(not important), and then after i'm done with the form i display dialogresult to open that same form again.
Question: how can i continue to open the same form?
While the Dialogresult is YES keep the form open(how to loop this)? the NO property breaks the loop.
I hope the question is clear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我给您的建议:
编辑:
我从您对问题的评论中得知,您想使用 MessageBox,因此您可以这样做:
Here is my suggestion for you:
EDIT:
I take from your comment to your question, that you want to use a MessageBox, so you can go like that:
如果当用户尝试关闭 frm1 时您显示一个对话框结果,如果答案是“是”,则不要执行任何操作。否则关闭 frm1。我希望我正确理解你的问题。
编辑:当你想关闭frm1时:
If when the user tries to close frm1 you are displaying a dialogresult, just don't do anything if the answer is yes. Otherwise close frm1. I hope I understood your question correctly.
Edit: When you want to close frm1: