I've been working on a project for a while, which for my convenience is a console app.

The time is nearing where I will be needing to add forms to it, so what I'm after here is any advice on things to consider and look out for, before I do this.

My thinking is I just change the output type in the project settings, but its probably more than that I guess.

I know there are search engines for things like this, but I've always gotten good sound advice here, so I hope you dont mind me pestering :)

Also, expect a torrent of form questions in the coming weeks :S

Appreciate any tips.

Recommended Answers

All 8 Replies

Redesign and start all over, possibly taking some previous methods with you.

Are you serious?

I've been working on this project for months, I thought I would be able to use the forms namespace and add from there.

I thought I was nearing the end, which is why I'm thinking of this, I wasnt banking on starting the whole thing again.

But if that is the best way to steer clear of more headaches then thats what I'll do, but with an anchor in my heart.

The issue is going to be moving from procedural code (the existing console app) to an event-driven model (the new forms app). How much of an issue this is depends on how well you've separated the core logic from the console stuff. You can't just "add forms" to the application--you will probably be able to reuse a fair amount of code, but I expect that you'll have to rewrite the entire structure around it, especially if your current experience is limited to console applications. ddanbe's "redesign" comment is appropriate; you'll need to think differently about how the forms application will work.

The only thing my project uses console for, is a convenient way for me to see the data its processing as it flows.

All I would need a form for is a simple way for a user to input some variables, which at the moment are hardcoded, and in an xml file. And perhaps display some output on a label or somethig.

Maybe I dont understand the differences between the types of projects, I thought the only difference was that one used the console window and the other used a windows GUI (I'm working with ms windows if that makes a difference).

I made a new forms project and dragged everything over from the console project. it had a cry aboy some linq namespace, but after commenting those, it seems to run fine, with the added bonus of my console output still in the VS window.

I must be dreaming, its all going to end in tears, I know it.

The only thing my project uses console for, is a convenient way for me to see the data its processing as it flows.

That should make it fairly simple to make the initial transition to forms, then.

All I would need a form for is a simple way for a user to input some variables, which at the moment are hardcoded, and in an xml file. And perhaps display some output on a label or somethig.

In that case, I recommend: Simple text boxes for the input, a button to start the processing, and a read-only multi-line text box for output. I prefer text boxes because they can grow scroll bars and you can select and copy from them--labels don't offer either.

Maybe I dont understand the differences between the types of projects, I thought the only difference was that one used the console window and the other used a windows GUI (I'm working with ms windows if that makes a difference).

This is true in the general sense that the code that does the work behind the scenes is the same in both cases, and the forms and console window are just ways of interacting with the user.

The difference is in how that interaction happens. A console application is typically rather linear, with one input and one output stream. A forms application is mainly event-driven, and has a different model for the user's "session" with your application. If you were starting from square one, you'd design the same application very differently for each of these approaches.

For now, the recommendation I made above should work just fine for you. Just be aware that there is much more going on with a forms application.

I made a new forms project and dragged everything over from the console project. it had a cry aboy some linq namespace, but after commenting those, it seems to run fine, with the added bonus of my console output still in the VS window.

It will run fine, but in a forms application, you won't want the processing to actually happen in the "main" method... if it does, then what's the point of bringing along all the forms baggage?

I must be dreaming, its all going to end in tears, I know it.

Not at all =) One step at a time.

Thanks for the detailed reply, I appreciate it.

You're welcome, and good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.