views:

46

answers:

2

I'm trying to make a winforms version of a program I originally wrote as a console app.

Here's a picture of my current progress. I've made the text boxes and buttons (with a read-only textbox for output). I don't know how to actually make the buttons function.

I want it to work the same as the console version did (ask for input w/ error messages for anything that isn't an positive integer, and calculate the output), but I've never done winforms before so I'm at a roadblock.

+3  A: 

Just double click the button and it will take you to the code behind page. You can do something as simple as add a textbox (TextBox1) add a button (Button1)

Double click button on your winform and it will take you to the click event of the button.

In the code behind type this:

TextBox1.Text = "Hello World!";

Now run your app and click the button.

JonH
This worked. Do variables and strings work differently in a winform program as well?
Slateboard
They are still variables and strings, so in that sense no a string is a string is a string is a string...:). Variables are still valid in winforms or console apps. int c; in a console app can be int c; in a winform app can be int c; in an asp.net web app. My recommendation is get a simple win form book. But as long as you know how to program through the console, you can take that knowledge to the next level (win forms / web apps). Then you need to pickup a book on events, UI, etc.
JonH
I have to say, after seeing this, everything is starting to click. Thanks so much.
Slateboard
No problem at all. If you have further questions or issues just post back. But like I said , you seem like you know what you are doing and you've done some code on a console app. It works pretty much the same as client apps (winform) or web apps. Although, once you get involved (especially with web apps) it gets a bit more involved. But the basics apply to all of them.
JonH
+4  A: 

As a beginner to WinForms, you would benefit greatly from reading up on the subject. For example:

Justin Ethier
I'll check this out. Thanks.
Slateboard