开发者

How to set another form to run as application in C#

I deleted default Form1 from my project and added another Windows Form as MyForm().How to set this to run as application. In fact I replaced

Application.Run(new Form()) 

to

Application.Run(new MyForm())

But its giving the following error:

Error 1 The type or namespace name 'MyForm' could not be found (开发者_StackOverfloware you missing a using directive or an assembly reference?)


Check the namespace of your new form and ensure that the application has it as a using directive.

The error means that the application class can't find the MyForm class, either because you didn't add the right assembly reference to the project (which could happen if the form is in another project), or because the form is in a different namespace (which could happen if you put it in another directory).


Providing that MyForm is a form located somewhere in your project or referenced then hover over MyForm() and press shift + alt + f10 , this should allow you to resolve the namespace :-)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜