vb.net gui unit_01

52
In this session, you will learn to: Appreciate the Graphical User Interface (GUI) Identify the controls of GUI Objectives

Upload: prashanth-shivakumar

Post on 14-Aug-2015

439 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: VB.Net GUI Unit_01

In this session, you will learn to:Appreciate the Graphical User Interface (GUI)

Identify the controls of GUI

Objectives

Page 2: VB.Net GUI Unit_01

Appreciate the Graphical User Interface

What is a user interface?

Page 3: VB.Net GUI Unit_01

Appreciate the Graphical User Interface (Contd.)

An interface is a layer between a user and an application. It helps the user to interact with the

application.

Page 4: VB.Net GUI Unit_01

The two types of user interface are:Character User Interface (CUI)

Graphical User Interface (GUI)

Appreciate the Graphical User Interface (Contd.)

Enter your name: John

Enter a book name: Famous Five

Sorry, The book is not available.

Do you want to check for another book (y/n):

In CUI, the user interacts with an application by typing commands.

The following figure shows the sample output of a CUI application.

A GUI provides a picture-oriented or graphical way of interacting with an application.

The following figure shows a sample output of a GUI application.

Page 5: VB.Net GUI Unit_01

Advantages of GUI applications are:They are easy to learn and use.

The users need not remember the lines of syntax.

Most of the commands are executed by using mouse.

Appreciate the Graphical User Interface (Contd.)

Page 6: VB.Net GUI Unit_01

A GUI application interacts with the users through various components, called controls.

The following figure shows a GUI screen containing various controls.

Identifying the Controls of GUI

Label

Text Box

Button

Combo Box

Page 7: VB.Net GUI Unit_01

Just a minute

A ____________ is a control that consists of other controls.

Answer:Container

Page 8: VB.Net GUI Unit_01

Windows provides the following types of dialog boxes:Modal

System modal

Modeless

Identifying the Controls of GUI (Contd.)

Page 9: VB.Net GUI Unit_01

Modal: It does not allow the user to switch focus to another area of the application, which has invoked the dialog box.

It allows the user to switch to other Windows applications.

The Save As dialog box of Microsoft Word is an example of modal dialog box.

Identifying the Controls of GUI (Contd.)

Page 10: VB.Net GUI Unit_01

The following figure shows the Save As dialog box.

Identifying the Controls of GUI (Contd.)

Page 11: VB.Net GUI Unit_01

System modal:It takes control of the entire Windows environment.

It does not allow the user to switch to any other Windows application until it is closed.

The Log On to Windows dialog box is an example of system modal dialog box.

Identifying the Controls of GUI (Contd.)

Page 12: VB.Net GUI Unit_01

The following figure shows the Log On to Windows dialog box.

Identifying the Controls of GUI (Contd.)

Page 13: VB.Net GUI Unit_01

Modeless:

It allows the users to switch to another area of the application or to another Windows application.

It remains on the screen and is available for use at any time.

The Find and Replace dialog box of Microsoft Word is an example of modeless dialog box.

Identifying the Controls of GUI (Contd.)

Page 14: VB.Net GUI Unit_01

The following figure shows the Find and Replace dialog box.

Identifying the Controls of GUI (Contd.)

Page 15: VB.Net GUI Unit_01

Just a minute

Which dialog box allows users to switch to another area of the application, which has invoked it?

Answer:Modeless dialog box

Page 16: VB.Net GUI Unit_01

Just a minute

A __________ acts as a container for a group of related controls.

Answer:Dialog box

Page 17: VB.Net GUI Unit_01

Identifying the Features of the Windows Environment

The features of the Windows environment that enable applications to interact effectively with the user are:

Event-driven programming

Dynamic linking

Page 18: VB.Net GUI Unit_01

Identifying the Features of the Windows Environment (Contd.)

Event-driven programming:Windows application can execute programs on a click of a mouse. An event is an action performed by the user.

Windows applications generate messages in response to each action performed by the user.

Depending on the messages received, the application performs preprogrammed functions.

Based on user’s input, an event gets generated. The code corresponding to the event is executed.

Page 19: VB.Net GUI Unit_01

Identifying the Features of the Windows Environment (Contd.)

Dynamic linking:The process by which an application is linked to the library functions at run time.

The reference to the function is looked up at run time. This is called dynamic linking.

Page 20: VB.Net GUI Unit_01

In this session, you learned that:GUI enables the users to interact with the application by using graphical components.

Windows provides three types of dialog boxes: Modal dialog box

System modal dialog box

Modeless dialog box

The main features of the Windows environment are:Event-driven programming

Dynamic linking

Summary

Page 21: VB.Net GUI Unit_01

In this session, you will learn to:Identify the features of .NET Framework

Objectives

Page 22: VB.Net GUI Unit_01

Identifying the Features of .NET Framework

What is .NET Framework?

Page 23: VB.Net GUI Unit_01

Identifying the Features of .NET Framework (Contd.)

.NET Framework is an integrated technology that

helps in creating and running robust, scalable,

and distributed applications.

Page 24: VB.Net GUI Unit_01

Microsoft introduced the .NET Framework to enhance the interoperability of applications.

The .NET Framework is designed to make improvements in:Code reuse

Code specialization

Resource management

Multilanguage development

Security

Deployment

Administration

Identifying the Features of .NET Framework (Contd.)

Page 25: VB.Net GUI Unit_01

.NET Framework offers a complete suite for developing and deploying applications.

The suit consists of:

.NET Products

.NET Services

.NET Framework

Identifying the Features of .NET Framework (Contd.)

Page 26: VB.Net GUI Unit_01

The following figure shows the different components of the .NET Framework.

Components of the .NET Framework

CLR is the environment in which

all programs that use .NET technologies are executed.

The CLR allows the execution of code across different

platforms by translating code into

Intermediate Language (IL).

At the presentation layer, .NET

provides three types of user interfaces. They are

Windows Forms, Web Forms, and Console Applications.

The .NET Framework class library works with any .NET language, such as VB.NET, VC++ .NET, and VC#.

The .NET Framework class library comprises namespaces, which

are contained within assemblies.

Page 27: VB.Net GUI Unit_01

Identifying the process of compilation:Compilation is the process of creating an executable program from the source code. It converts source code into machine language.

In .NET, the conversion of source code to machine language takes place in two stages:

In the first stage, the compiler translates code into an IL instead of machine language or assembly language.

In the second stage, the JIT compiler converts IL into machine language at run time.

Components of the .NET Framework (Contd.)

Page 28: VB.Net GUI Unit_01

The following figure shows the process of code compilation.

Components of the .NET Framework (Contd.)

Program CodeCompiler

IL Metadata

Assembly

+

Machine CodeJIT Compiler

Page 29: VB.Net GUI Unit_01

Identifying the process of code execution:During execution, CLR performs the following steps:

Loading assemblies and identifying namespaces

JIT compilation

Garbage collection

Components of the .NET Framework (Contd.)

Page 30: VB.Net GUI Unit_01

The following figure shows the process of code compilation.

Components of the .NET Framework (Contd.)

SetTopScore()

IgnoreScore()

SetTopScore()

Visual C# Code IL Code

IgnoreScore()

Page 31: VB.Net GUI Unit_01

The following figure shows the process of code execution.

Components of the .NET Framework (Contd.)

JIT

SetTopScore()

IgnoreScore()

SetTopScore()

Machine LanguageIL Code

is invoked

SetTopScore()

Page 32: VB.Net GUI Unit_01

The following advantages are offered by the .NET Framework:

Consistent programming model: The .NET Framework provides a common object-oriented programming model across languages.

Multi-platform applications: A .NET application can be executed on any platform and architecture supported by CLR.

Multi-language integration: .The NET Framework allows integration of multiple languages. You can create a VC# class deriving from a VB.NET class.

Automatic resource management: The CLR tracks resource usage and relieves a programmer from the task of manual resource management.

Ease of deployment: .NET applications can be deployed simply by copying files to the target computer.

Components of the .NET Framework (Contd.)

Page 33: VB.Net GUI Unit_01

In this session, you learned that:.NET Framework is made up of many components, such as CLS, CLR, and JIT compiler.

The CLR is the environment where all .NET applications are executed.

CLS is a set of rules that are followed by all the languages of the .NET Framework.

When a program is compiled by using Visual Studio, the compiler translates the code into IL instead of machine language.

The JIT compiler is used to translate the code from IL into machine language.

Summary

Page 34: VB.Net GUI Unit_01

In this session, you will learn to:Use Windows project by using Visual Studio .NET integrated development environment

Objectives

Page 35: VB.Net GUI Unit_01

The Visual Studio .NET IDE provides you with a common interface for developing various kinds of applications.

The IDE also provides you with a centralized location for:Designing the user interface for an application.

Writing code for the application.

Compiling the application.

Debugging the application.

Using Visual Studio .NET IDE

Page 36: VB.Net GUI Unit_01

In Visual Studio .NET, an application can be made up of one or more items, such as files and folders.

To organize these items efficiently, Visual Studio .NET provides two types of containers:

Projects

Solutions

Creating Projects and Solutions

Page 37: VB.Net GUI Unit_01

Project: It contains interrelated items that make up the application.

It allows you to manage, build, and debug the items.

An executable file (.exe) or a Dynamic Link Library (.dll) is created when you build a project. These files are called the project output.

Solution: It acts as a container for one or more projects.

It allows you to work on multiple projects within the same instance of the Visual Studio .NET IDE.

Creating Projects and Solutions (Contd.)

Page 38: VB.Net GUI Unit_01

The following figure shows a solution containing multiple projects.

Creating Projects and Solutions (Contd.)

Solution

Project 1

Project 2

Miscellaneous Files

Project 1Items

Project 2Items

Page 39: VB.Net GUI Unit_01

Creating Projects and Solutions (Contd.)

Let us see how to create a Windows application in Visual Studio .NET IDE.

Page 40: VB.Net GUI Unit_01

The following table describes various templates available in the Templates pane.

Creating Projects and Solutions (Contd.)

Template Description

Windows Application It creates Windows-based application.

Class Library It creates a class or a reusable component (.dll or .exe) that exposes some functionality to be used in various projects.

Windows Control Library

It creates a custom control that can be added to the user interface.

Console Application It creates a CUI-based application that can run from the command prompt.

Device Application It creates a .NET Compact Framework 2.0 forms application for Pocket PC 2003 and later.

Crystal Reports Application

It adds a Windows user interface and a sample crystal report in the .NET application.

Page 41: VB.Net GUI Unit_01

Just a minute

Which template creates a .NET Compact Framework 2.0 forms application for Pocket PC 2003 and later?1. Windows Control Library

2. Class Library

3. Device Application

4. Web Control Library

Answer:3. Device Application

Page 42: VB.Net GUI Unit_01

Creating Projects and Solutions (Contd.)

Let us see various user interface elements of

Visual Studio .NET IDE.

Page 43: VB.Net GUI Unit_01

The following figure shows various interface elements of Visual Studio .NET IDE.

Creating Projects and Solutions (Contd.)

Solution Explorer Window

Windows Form Designer

Toolbox WindowProperties Window

Output Window

Menu Bar

Page 44: VB.Net GUI Unit_01

The following table describes various windows of Visual Studio .NET IDE.

Creating Projects and Solutions (Contd.)

Window Name Description

Output Window It displays messages regarding the status of various features provided in the Visual Studio. You can open it by selecting ViewOutput. Alternatively, you can use the key combination Ctrl+W, O.

Server Explorer Window

It is a tool used for various administrative tasks, such as monitoring the performance of other machines on a network, and locating and connecting to the various servers on the network. You can open it by selecting ViewServer Explorer. Alternatively, you can use the key combination CTRL+W, L.

Class View Window It displays the classes, methods, and properties associated with a particular file. You can open it by selecting ViewClass View. Alternatively, you can use the key combination Ctrl+W, C.

Dynamic Help Window

It provides you with context-sensitive help. You can open the dynamic help window by selecting HelpDynamic Help. Alternatively, you can use the key combination CTRL+F1, D.

Page 45: VB.Net GUI Unit_01

Just a minute

Which window displays messages for the status of various features provided in the Visual Studio .NET IDE?

Answer:The Output Window

Page 46: VB.Net GUI Unit_01

Just a minute

Which window allows to view the resources of the servers, such as services, processes, and the event log?

Answer:The Server Explorer window

Page 47: VB.Net GUI Unit_01

Navigational Features in Visual Studio .NET IDE

The three navigational features provided by Visual Studio .NET IDE are:

Docking: Allows you to place a window against any of the edges of the parent window.

Tabbed: Allows overlapping of various open windows and navigating between them by using tabs.

Auto Hide: Automatically hides a window when it is not in use.

Page 48: VB.Net GUI Unit_01

Navigational Features in Visual Studio .NET IDE (Contd.)

Let us see how to use various navigational

features provided by the Visual Studio .NET IDE.

Page 49: VB.Net GUI Unit_01

Compiling and Executing a Project

Let us see how to compile and execute an

application.

Page 50: VB.Net GUI Unit_01

In this session, you learned that:The Visual Studio 2005 IDE provides you with a common interface for developing various kinds of applications on the .NET Framework.

Some of the components of the Visual Studio .NET IDE are:The Windows Forms Designer

The Solution Explorer window

The Properties window

The Toolbox window

The Output window

The Code and Text Editor window

Summary

Page 51: VB.Net GUI Unit_01

The Visual Studio .NET IDE also provides three navigational features. These are:

Docking

Tabbed

Auto hide

Summary (Contd.)

Page 52: VB.Net GUI Unit_01

Let me give you some questions to solve at

home.

Home Assignment