开发者

Weird form error

开发者 https://www.devze.com 2023-04-03 20:42 出处:网络
I\'m working on something in c# and I get an error when I try to execute this code Code: Form form3 = new Form3();

I'm working on something in c# and I get an error when I try to execute this code

Code:
Form form3 = new Form3();
                    form3.Show;

Heres the error I get

Error: 
only assignment ,call ,increasement ,decreasement ,and new object expressions 
can be used as a sta开发者_JS百科tement

I usually dont get this error when I'm coding & thanks in advance


Just a typo, man:

Form form3 = new Form();

You called Form, Form3 when you called the constructor.

=)

EDIT: You also weren't calling the Show and close functions properly:

private void button1_Click_1(object sender, EventArgs e) 
{ 
  Form form3 = new Form(); 
  form3.Show(); 
  this.Close(); 
}


form3.Show looks like the culprit. It should be form3.Show(). Without the parens it doesn't execute the method.

0

精彩评论

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