Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 463
  • Last Modified:

Convert Windows Form Application to Console Application

Hi all,

I have a Windows Form Application with a single form,
and I got rid of all the controls on it.
What is the best way to convert my project to Console Application?

Any help is appreciated,

Thank you
0
darrgyas
Asked:
darrgyas
4 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
why would you do that? if you just want to run your application from a scheduler, it does not require to be console.
0
 
Éric MoreauSenior .Net ConsultantCommented:
otherwise, start a new application using the console template and move the files you need
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Your forms code gets initiated thru either the Constructor, Load() or Shown() event.  Just move that code to the Main() method of your Console application (along with any supporting methods/functions).

If it's more complicated than that then please show us the code in question.
0
 
LIONKINGCommented:
Create a new project, add existing items for all your classes.
Copy all your logic (code) from the Form to the program.cs.

If any events have to be taken care of, you'll probably need to add some logic to the console application.

If it's not big, it would be easier if we saw at least the structure of the code.
0
 
darrgyasAuthor Commented:
I was hoping for some magic, like a tweak in a project file or something like that.
I guess not.
Thank you all
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now