fire up visual studio (from here on to be called "VCS" for "Visual C# Studio"). complete any config wizards it has. Register it to avoid getting hounded every time you open it.
first off, we are going to start a project.
on the start page, click "Project..." after "Create"
By default, it should have "Windows Application" selected. in the "Name" line, type "Lesson1", then hit "OK". this will make a new programproject called "Lesson1". (crazy how that works....)
VCS will create some fun little files for you, and the main window will have an ugly little box that says "Form 1". you should have a menu that says "Toolbox". In Toolbox, there will be an area called "Common Controls". click on "Button". now click on the ugly little "Form 1". See? There's a button now!
Double-click the button. Dont be scared. this is where you program. you will see something that looks like this:
private void button1_Click(object sender, EventArgs e)
{
}
Make it look like this:
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("YOU CLICKED A BUTTON!");
}
NOTE: C# is case sensitive, so ANYTHING not inside quotation marks (in this case, anyhing NOT "YOU CLICKED A BUTTON!") HAS to be typed as I have shown.
Did that? Good. now hit "Ctrl-f5" on your keyboard. This will compile and launch your program.
When the new ugly little window pops up, click the button. YAY! see? You just wrote a verrry simple program. Pat yourself on the back.
close your little program and go back to VCS. hit ctrl-shift-S. A save dialogue will come up. just hit "save". This way, your project will still be there if your computer suddenly reboots.
Last edited by Vodstok; 11-20-2006 at 12:58 PM.
|