vbnew.pptx

30
Visual Programming Fourth Semester B.Sc. Mathematics/Physics

Transcript of vbnew.pptx

Visual ProgrammingFourth Semester B.Sc. Mathematics/Physics

What is Visual Programming ?

In computing, a visual programming language (VPL) is any programming language that lets users create programs by manipulating program elements graphically rather than by specifying them textually

Microsoft .NET Framework1. A programming infrastructure created by Microsoft for building, deploying, and

running applications and services that use .NET technologies, such as desktop applications and Web services. The .NET Framework contains three major parts: the Common Language Runtime. the Framework Class Library.

2. It includes a large class library known as Framework Class Library (FCL) and provides language interoperability (each language can use code written in other languages) across several programming languages.

3. Programs written for .NET Framework execute in a software environment (as contrasted to hardware environment), known as Common Language Runtime (CLR), an application virtual machine that provides services such as security, memory management, and exception handling. FCL and CLR together constitute .NET Framework

.NET VersionsMicrosoft developed the .NET framework under the name of Next Generation Windows Services (NGWS)

Microsoft .NET Framework

Components of .NET Framework

Common Language Runtime CLR

1. The Common Language Runtime (CLR), the virtual-machine component of Microsoft's .NET framework, manages the execution of .NET programs.

2. A process known as just-in-time compilation converts compiled code into machine instructions which the computer's CPU then executes

3. The CLR provides additional services including memory management, type safety, exception handling, garbage collection, security and thread management

4. All programs written for the .NET framework, regardless of programming language, are executed by the CLR.

5. All versions of the .NET framework include CLR.

Just In Time Compiler

The .NET IDEInstead of multitude of tools for development, the Microsoft created a single tool for developing Windows Forms, ASP .NET Web applications and XML Web Services. This tool is called Visual Studio.

Can be used to write: console applications, ASP .NET applications, Windows Applications, etc

It supports : Visual C++, Visual Basic .NET , Visual C# .NET etc

Projects and SolutionsIn visual studio, programs under development are called project or solutions.

Project• A project is a collection of files, such as code files, resources, data and

every other kind of file to build the final assembly.• A VB project file is represented by a .Vbproj fileSolution• A solution is a container for projects• Projects are organized in solutions• Solution can contain infinite number of projects of different kinds• A VB solution file is represented by a .Sln file

Visual Basic .NETVB.Net is a simple, modern, object-oriented computer programming language developed by Microsoft to combine the power of .NET Framework and the common language runtime with the productivity benefits that are the hallmark of Visual Basic.

Visual Basic 2010 IDE

VB IDE Start Page

1. Gateway to for performing tasks with visual basic2. Open previously edited projects3. Create new projects

The New Project Dialog Box

Used for creating the new project dialog boxYou can either click the File New Project Command orThe New Project Link from the start page

New Project Dialog Box1. Contains List of project types you can create with visual studio2. The most important one are Windows forms Applications, which

are typical windows applications with one or more forms; Console applications, which are simple applications that interact with user through a text window

The Menu System

1. Menu Bar2. Standard Toolbar 3. ToolBox 4. Forms Designer5. Output Window6. Solution Explorer7. Properties Window

ToolbarsContain tools that you can use to perform frequently needed actions

Design WindowUse to draw the interface on your formRefred to as designer

Code Editor How to display line numbers in code editor?

Tools Options navigate to Text Editor Basic Editor Page and Check the Line Numbers Box

Margin IconsThe Grey margin to the left of the line numbers contains icons giving information about the corresponding line of code

Otlining

ToolTips1. If your hover the mouse over a variable at design time, the editor

displays a tool tip describing the variable2. For example, if you hovered over an integer variable named

num_actions, the tooltip would display ”Dim num_actions As Integer

IntelliSense

Code Coloring and Highlighting

Different Types of Code in different colors

Item Highlighting

Comment Green Text

Compiler Error Underlined with a wavy blue underline

Keyword Blue Text

Other Error Purple Underline

ToolboxList View

Show All

Choose Items

Sort Items Alphabetically

Reset Toolbox

Add Tab

Delete Tab

Rename Tab

Move Up, Move Down

Adding Control to the Form

Four Ways

Event Driven ProgrammingWhen the user clicks , presses key or moves the mouse, the particular block of code of the corresponding event procedure is executed. Then the program behaves in a certain way. This is event driven programming. When you fire an event, the code in the event procedure is executed, and then visual basic does what the code in the event procedure instructs to do. For example,  in the first sample program, when you click the Print button, click event is fired. Then the code in the click event procedure gets executed. The code instructs to print a text on the form. After that you see a text printed on the form. This is the concept of event driven programming. That means , the code is not executed from top to bottom but it works when the corresponding event procedure is invoked.

Common Type of User Initiated Events

Mouse DownClickMouse Click MouseUpDouble ClickMouseDoubleClick

Mouse Events

Keyboard EventsKeyDownKeyUpKeyPress