本文介绍了有关ShowDialog的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我有一个关于ShowDialog方法的快速问题。我有第二个表单,我希望在单击按钮时显示。到目前为止我有这种方法:



Hi everyone! I have a quick question regarding the ShowDialog method. I have a second form that I want to be shown upon a button click. I have this method so far:

private void insertMakeButton_Click(object sender, EventArgs e)
        {
            newMakeForm.ActiveForm.ShowDialog();
        }







当我点击相应按钮时我得到的错误是:

已经可见的表单不能显示为模式对话框。在调用showDialog之前将表单的可见属性设置为false。



有人能说清楚我做错了吗?



谢谢大家!




The error I''m getting when I click on the corresponding button is:
Form that is already visible cannot be displayed as a modal dialog box. Set the form''s visible property to false before calling showDialog.

Can someone shed some light as to what I''m doing wrong?

Thanks everyone!

推荐答案

if( newMakeForm.Visible ) 
{ 
   newMakeForm.ActiveForm.Visible = false; 
}
newMakeForm.ActiveForm.ShowDialog();



这篇关于有关ShowDialog的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-09 21:30