开发者

if and else for visible form [closed]

开发者 https://www.devze.com 2023-03-30 08:45 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help cent开发者_如何学Cer. Closed 10 years ago.

i have this code but return error

private void formshow_Click(object sender, EventArgs e)
        {
           if (form1.Visible)                
               {
                   MessageBox.Show("This form is visible");
               }
           else
               {
                   Form2 f = new Form2();
                   f.Show();
               } 
        }

help me please


Is form1 the type of the current instance? If so, change if (form1.Visible) to if (this.Visible) or simply if (Visible).

0

精彩评论

暂无评论...
验证码 换一张
取 消