You are on page 1of 6

9/18/2018

GUI Ms. Sathya Wijewardhana


B.Sc. (Hons) Computer Science Special , M.Sc. – UOP

sathya@nibm.lk

GUI Application Development REFERENCES

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…..

• The latest stable version is 7.0 (Launched in 2017).

Introduction to C#.NET
• C# is a programming language
• It defines grammar (syntax) and meaning (semantics) of the
code we write.

• .NET is a software framework


• It includes software libraries we can use to develop programs.
• C# is integrated with the .NET framework.
• So the user can use C# in an easy and effective manner.

• Visual studio is the IDE (Integrated development Environment)


• Environment or the software we use to create C# programs.
• VS IDE contains C# language and the .NET framework.

Main Components of the IDE


• This is the environment where you develop applications and
debug them (the development tool).
1. Form Window
2. Toolbox Window
• Microsoft provides the following development tools for C#.Net 3. Properties Window
programming. 4. Solution Explorer Window
5. Server Explorer Window
ꟷ Visual Studio (VS) 6. Code designer
ꟷ C# Studio 7. Task List Window
ꟷ MonoDevelop Open source 8. Output Window
ꟷ SharpDevelop 9. Class View Window and etc…..

• The latest version is VS 2017.

2
9/18/2018

1. Tool Box window


• This contains controls (tools).
Form window Code window • Controls can place in the form at the design time.
• There are many sections in the tool box.
Solution • Containers
Explorer • Menus and Toolbars
• Data , and Etc....

2. Form (Form window)


• Defined in the System.Windows.Forms.Form class in .NET
Framework.
Tool box Properties • The container for other controls.
window
Ms.Sathya - NIBM Kandy

3. Properties window 4. Solution Explorer


• Describe the characteristics of particular control.
• Eg: Text Box • Display the hierarchy of the project
Back Color -Set background color • Show all Forms and other files under each project.
Text -Insert text to the textbox
Enable -Active the textbox
Button
Visible -Show/Hide the button
Text - Insert text
Text Align -Align the Text box

5. Code Designer 6. Server Explorer


• Used to write/edit the code for a control or any • Server Explorer gives facilities to create and
other operation. handle data connections.

• 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

7. Task List 8. Output Window


• Give the results of building and running programs.
• Display the tasks you have to do.

• 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.

How to Start a C#.Net Program


Open the Visual Studio.Net IDE and take the following
10. Tool Bars steps:
• At top of the IDE.
1. Start Visual Studio  Menu bar  File  New Project  Visual C#
• Provide quick way to select menu items.  Console Application/Windows form application.
Eg: Standard Toolbar
• Note: Using C#.Net you can create many types of applications
Build Tool Bar (programs).
Eg: Windows applications
Web applications
Console applications

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.

1. Name and describe different windows of the Visual


Studio IDE.
1. Create your form or write code in the Code Editor
2. Click the Run button or the F5 key to run.
3. Then you will see the output. 2. What are the types of projects can a developer create
using C#.NET in the Visual studio IDE?
Note: When you are running the project you cannot edit anything.

4
9/18/2018

3. Which is not a main component of the Visual Studio


IDE?
a) Solution Explorer
b) Tool Box
c) Start Menu
d) Designer Window
e) Properties Window

4. Visual Studio Software Development Environment


provides which feature
a) Building Application.
b) Application deployment.
c) Automatic syntax checking.
d) Both a and b.
e) All of the above.
Sathya - NIBM Kandy

A C#.Net program basically consists of the following parts:


using System;
namespace HelloWorldApp  Imported namespaces
using System;
{  Namespace declaration namespace HelloWorldApp
class Program  Class declaration {
{  The Main method class Program
static void Main(string[] args)  Some other methods {
{ static void Main(string[] args)
// This is a single line comment  Comments
{
/* This is multiple line  Statements/ Expressions // my first program in C#
comment  Variables /* This will print Hello World in the
*/ screen*/
Console.WriteLine("Hello World"); Console.WriteLine("Hello World");
Console.ReadKey(); Console.ReadKey();
} }
} }
} }

• 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)
{

}
}
}

You might also like