Professional Documents
Culture Documents
sathya@nibm.lk
LEARNING OUTCOMES
At the end of this module, student should be able to: Book Author(s) ISBN Publisher
1. Explain .NET Framework and the basic concepts of programming in C# Head first C# Jennifer Greene, Andrew 1449343503 O’Reilly Media
2. Apply OOP concepts with C# Console Applications Stellman
3. Design Windows Forms using basic tools and advanced tools Microsoft Visual John Sharp 1509301046 Microsoft
4. Apply business logics for software C# Step by Step Publications
5. Use advanced controls for software
6. Apply Input Validation, Exception Handling and
7. Apply Multithreading for GUI applications
8. Design GUI database applications and create reports
9. Create setup file and install it in a different computer
ASSESSMENT
Assessment methods/tasks % Weighting
Practical test 10
Assignments 20
Mid test 10
Final Exam 60
1
9/18/2018
Introduction to C# Introduction to C#
• C# is a modern, general purpose, object oriented high level • C# can be used to develop
programming language.
1. Windows applications – Software run in the Windows OS
• Developed by Anders Hejlsberg and his team at MICROSOFT 2. Web Applications – Websites
during the development of .Net Framework in 2000. 3. Console Applications – Runs in the DOS window
4. Mobile Applications – Runs on mobile phones
• It is implemented on the .NET Framework (Called C#.NET).
and etc…..
Introduction to C#.NET
• C# is a programming language
• It defines grammar (syntax) and meaning (semantics) of the
code we write.
2
9/18/2018
• Can use tabs at the top centre of the IDE to switch • Show available servers and databases.
between Form and the Code designer.
3
9/18/2018
• Eg:
9. Class View
• If an error of a code has detected then it will • Present solutions and projects in term of the
display in the task list.
classes they contain.
• If you click on that error description then location of
the error will highlight in your code. • Also this includes the members of these classes.
2. Specify a name and location for your project and then press the OK
button.
The new project appears in the IDE. You can see the project name at
the ‘Solution Explorer’ window.
4
9/18/2018
• Using System: Use the “System” namespace. • Console.WriteLine: WriteLine is a method of the Console class
What is a namespace? defined in the System namespace.
This method write what ever we include in double quotations on the
screen(console).
• namespace HelloWorldApp : The namespace under which our
So it causes the message "Hello, World!" to be displayed on the screen.
program should declare.
• Console.ReadKey() : This line will ask the program to wait for a user
• Class Program: Class declaration. input.
C#.Net is object oriented every program must contain in a It prevents the screen from running and closing quickly when the program
class(contains the data and procedures) is launched from Visual Studio .NET
• static void Main(string[] args) : The main method declaration. • Note: We have used the System namespace because we need to use these two
A method is a block of statements enclosed by a declaration statement (WriteLine and ReadKey) methods. They are implemented in the Console class created
and two curly brackets. in the System namespace. So by using that namespace we can reuse those methods
without implementing them again.
This is the starting point of your program.
Sathya - NIBM Kandy
5
9/18/2018
using System;
• Write a C#.NET console program in your book to namespace HelloWorldApp
display your first name. {
class Program
{
• Compare and contrast your program with a similar
static void Main(string[] args)
(function wise) program written using C or C++. {
// This is a single line comment
/* This is multiple line
comment
*/
Console.WriteLine("Hello World");
Console.ReadKey();
}
}
Sathya - NIBM Kandy }
using System;
using System.Windows.Forms;
namespace AirLineResSyt
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnTotal_Click(object sender, EventArgs e)
{
}
}
}