Getting Started
Example ICS2O curriculum
"C# is intended to be a simple, modern, general-purpose, object-oriented programming language"
Developed by Anders Hejlsberg
15 years old – created after Java
Top 10 Programming
Languages
C# is number 4
IEEE Spectrum, July 19 2014
Stephen Cass
Based on
"12 metrics from 10 sources
(including IEEE Xplore, Google, and GitHub) to rank the most popular programming languages"
• collection of software/libraries used by Windows applications
• C# is one of many languages supported by .NET
Graphical / Forms Text / Console
• You can specify the project name as you create a new project or as you
save a project
This is where the solution folder will be created
Project name
Project name Solution name
Hello World
Forms Applications
DESIGN MODE
RUN MODE
• Visual Studio has 2 different modes
• Design
• Runtime
• Control properties can be modified
• at design time (static), or
• while the program is running (dynamic)
• Visual Studio is a professional integrated development environment (IDE)
• Tools:
• Designer Window (1)
• Solution Explorer Window (2)
• Properties Window (3)
• Free versions are available as
Visual Studio Express on
Microsoft's website
(1)
(3)
(2)
Form is a container for the controls that the user will use while the program is executing.
Add controls from the toolbox
TOOLBOX
• Objects are created from their associated Class
• A Class is like a blueprint which defines the properties and methods/tasks.
Form object
Label objects TextBox objects
Button objects
First Set of Controls
Forms, Labels, Textboxes, Buttons
Form - window that is displayed on the screen which contains other objects.
Label – displays text within a Form
TextBox – defined region used to accept text input from a user
Button – defined area that is used to start an event generated by the user
Note: Most of your application code will be associated with a Button Click event. If you double click on Control you will have the opportunity to view/modify the code or actions that will occur when the event happens.
Textbox
• GUI control object that is used to obtain keyboard input from the user
Example string name = txtName.Text; int age = int.Parse(txtName.age);
Button
• Control object for user-generated events.
• Write code behind for a Button Click
Label
• GUI control object that is used to display text at a specific location on a form
• Example lblMessage.Text = "Some Message";
• The displayed text is defined by the Text property of the Label
• The data on the left side of the = operator must be a string
TextBox
• GUI control object that is used to display or obtain text at a specific location on a form
• Example tbMessage.Text = "Some text message";
• Set the property ReadOnly to True to displaying text
Message box
• a small window (dialog box) that displays a text
• Example
MessageBox.Show("Some text message");
• MessageBox is a Class and not a control on a form
• To create a message box you call the Show method on the Class.
• The argument that is passed must be a string
• Console / GUI
• Math operations
• Variables
• Data type conversions
• Selection if / booleans
• Counted loops (for)
• Random
• Picturebox (GUI)
• Timers (GUI)
• User input (GUI) radio buttons / checkboxes
• Conditional Loops
• Listbox
• Files
• 1D Array