开发者

Porting console app to winforms C#, static types error

开发者 https://www.devze.com 2023-03-08 07:12 出处:网络
I made a nice little console app with some 3rd party libraries and stuff. But now I want to port it to winforms.

I made a nice little console app with some 3rd party libraries and stuff. But now I want to port it to winforms. I just copy everything from the console to a new class in the winforms, removed the main and hoped it would work.

But no.

I just get the error static types cannot be used as parameters in some of my functions. Said functions work perfectly well in my console app. And the parameter used in the functions are all from a 3rd party mouse-control library.

What am I 开发者_JAVA百科missing? : /


Remove static keyword from all your declarations. I'm sure that you put them there to make sure that your static main function for the console app would be able do directly access them. Now as you don't have a static main function, you don't need the static types anymore.


You could just change your existing project into a Winforms project - see How do I convert a .NET console application to a Winforms or WPF application

0

精彩评论

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