converting windows app to console app

  • Thread starter Thread starter cs_hart
  • Start date Start date
C

cs_hart

I have a vb.net windows app that has input from two text boxes and a
list box that allows one selection. I would like to convert this to a
console app so I can execute it from a vb6 app and pass the inputs as
parameters.
Can someone tell me or point me to documentation on how to change this
app?
thanks for any assistance
 
I have a vb.net windows app that has input from two text boxes and a
list box that allows one selection. I would like to convert this to a
console app so I can execute it from a vb6 app and pass the inputs as
parameters.
Can someone tell me or point me to documentation on how to change this
app?
thanks for any assistance

I don't think you can convert a windows app to a console app. My guess
is that the best way to do this is to create a new console app and cut
and paste what you need from the windows app to the console app.
 
I have a vb.net windows app that has input from two text boxes and a
list box that allows one selection. I would like to convert this to a
console app so I can execute it from a vb6 app and pass the inputs as
parameters.
Can someone tell me or point me to documentation on how to change this
app?
thanks for any assistance

If it were me I'd create a new Console project and use Project --> Add
Existing File to add in your class files. That should leave you the
implementing of the startup parameters.

Also, if you follow a design pattern such as MVC you could have been
much more prepared when you needed to swap out Views. Also, adding the
logical chunks as new projects could help in this as well, your Form
would be in a project, your Console would be in another project, and
both would reference a project that does all the work.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
Make a copy of your project

Change the class name to Module and the End Class to end module

As you have used a Form_Load event then change that to Public Sub Main

Go to project properties and tell that it is a console application

Set in those properties as start up Sub Main

Set show all files to All and remove the designer part and the resx from the
previous form class

As I don't forget something, that you obvious see:

Done

Don't forget from the private to make public something I always forget.

Cor
 
It seems to me the easiest thing to do is in the constructor for your main
form, check if the command args were passed with
Environment.GetCommandLineArgs. You could then skip to the form processing
logic, while making the form invisible.
 
Thanks for all the responses. I think I'll try the new project avenue
first. This is why I hate modifying an app that someone else wrote -
"just to get it into production quickly".
 
Back
Top