有关ShowDialog的问题 [英] Question regarding ShowDialog

查看:141
本文介绍了有关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();


这个我不清楚请在下面填写:

1. insertMakeButton在哪里,在第二种形式或其他形式?

2.是否已经在aaplication中创建了第二个表单对象?
This is not clear to me can please clerify below:
1. Where is the insertMakeButton, on second form or in some other form?
2. Is Second form object already created in the aaplication or not?


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆