Video Tutorial (The New Boston)

Introduction

These videos are part of the 200 videos (!) about C# which can be found at The New Boston. I am making an attempt to provide learning goals and activities to support each of them.

Note!

All files for this tutorial series should be saved in your class folder under a folder named something similar to "TheNewBoston2010" or "TheNewBostonC#".

Keep your files organized!

01 Introduction and Installing C# 2010

Learning Goals

  • We will discover that C# only creates programs for the Windows platform.

  • We will find out where to download C# 2010 Express Edition from.

  • We will create and properly name a new Windows Form project.

  • We will modify the Toolbox to make it more user friendly.

  • We will dock the Toolbox so it doesn't disappear all the time (i.e., turn off auto-hide).

  • We will view some basic properties of our program (form).

  • We will experiment with a form's Text and BackColor properties.

Note!

You do not have to install the software if you are at school. It should already be installed for you. Also, this video tutorial is for Visual Studio 2010, but you can go ahead and download the latest version of Visual Studio Express and it should be fine.

Activity - Playing with Properties

    1. Create a new Windows Form Application project named TNB001-Setup.

    2. Dock the Toolbar the same way as done in the video.

    3. Rename the form "Temp Program" and change the background so it is a neutral colour other than white.

    4. Save this project and submit the entire folder to the appropriate handin folder.

02 Changing Forms Properties

Learning Goals

    • We will change the size of our form.

    • We will add objects by dragging it onto the form or clicking and dragging.

    • We will move our objects on the form by dragging it.

    • We will align objects with the built-in guides.

    • We will hold down <alt> to eliminate the built-in guides.

    • We will change the properties of an object (such as Text or Background Colour)

    • We will debug (run) our program with the green arrow icon or F5.

    • We will stop debugging (running) our program with Shift-F5.

    • We will learn about other properties by experimenting and sharing with the class.

Activity - Playing with Properties II

  • Create a new Windows Form Application project named TNB002-Properties.

  • Add a button and a label to your form.

  • Resize both objects so they are the same width.

  • Modify the text on the objects to something appropriate for a typical program.

Activity - Discovering Other Properties

  1. Create a new Windows Form Application project named TNB002a-MoreProperties.

    1. Recreate the same program as above.

    2. Look through the properties for each of the form, the button, and the label.

    3. Experiment with some of the properties to see what they do, and modify your program accordingly to take advantage of at least a few of them.

    4. Be prepared the share what you have learned about at least one interesting property.

    5. Save this project and submit the entire folder to the appropriate handin folder.

03 Showing MessageBoxes

Learning Goals

    • We will add a button the form.

    • We will add a "click" event to our button.

    • We will display a MessageBox to the screen, with an optional title.

    • We will use Intellisense to help automate our program editing.

    • We will use a text "parameter" with a the show command.

    • We will add a "hover" event to our button.

Activity - Message Box

    1. Create a new Windows Form Application project named TNB003-MessageBoxes.

  1. Create the same program as shown in the video (including the Hover event), but enter your name as the title of the click event message box.

    1. Save this project and submit the entire folder to the appropriate handin folder.

04 Variables

Learning Goals

    • We will learn that variables are "placeholders" for values and use them accordingly.

    • We will declare variables to the program using the proper syntax.

    • We will use a string variable to store text.

    • We will use double-quotes to enclose the text in our string variables.

    • We will use a MessageBox to display a variable.

    • We will learn that an int variable is used to store integers (whole numbers).

    • We will learn that a bool variable is used to store boolean (true or false) values.

    • We will learn that the ToString() method is used to convert non-strings to strings.

    • We will learn that we can use an object variable to store any type of variable.

    • We will use a button to change the text in a label using a string variable.

Activity - Button and Label with a String Variable

  1. Create a new Windows Form Application project named TNB004-VariablesClickMe.

    1. Watch and create the same program that shown in the following video and submit to the relevant handin folder.

05 Changing Properties With Code

Learning Goals

    • We will modify button text by using code instead of the property inspector.

    • We will use the Disable property of a button to enable or disable it.

    • We will use the Height property of a button to change the height of it.

Activity - Using Code to Modify Properties

  • Create a new Windows Form Application project named TNB005-Properties.

  • Create a program with three appropriately labelled buttons and a blank text box.

  • Modify the code of the first button so it changes the Text of the text box when clicked.

  • Modify the code of the second button so it changes the height of the text box when clicked.

  • Modify the code of the third button so it clears the text of the text box, resets the height of the text box, and disables the button.

    • Save this project and submit the entire folder to the appropriate handin folder.

06 If, Else If, Else Statements

Learning Goals

    • We will use an if statement to execute code conditionally.

    • We will use braces ("{ }") to enclose a block of code.

    • We will use an else if statement to execute alternative code conditionally.

    • We will use an else statement to execute code when the previous conditional statements are not true.

Activity - Using If Statements

  • Create a new Windows Form Application project named TNB006-If

  • Create the same program as shown in the video. Be sure you are using else, else if, and else statements.

    • Save this project and submit the entire folder to the appropriate handin folder.

07 More on If Statements

Learning Goals

    • We will...

Activity - TBD

  • Create a new Windows Form Application project named TNB007-MoreIf

    • Write a program that changes a button's text to "True" if the checkbox is true and "False" if it is not checked.

Supplemental Activity

    • Create a program similar to the screenshot below. Be sure it handles >, =, and <.

    • Submit as TNB007-MoreIfSupplement.