Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hands-on Introduction to Visual Basic .NET

Similar presentations


Presentation on theme: "Hands-on Introduction to Visual Basic .NET"— Presentation transcript:

1 Hands-on Introduction to Visual Basic .NET
6 Hands-on Introduction to Visual Basic .NET Programming Right from the Start with Visual Basic .NET 1/e

2 Objectives Have hands-on experience developing applications with Visual Basic .NET and Visual Studio .NET Understand events and their relationships to the graphical user interface Explain the advantages of objects for developing applications

3 Objectives (cont.) Understand and effectively use the Button, Label, and PictureBox controls Successfully write Windows applications that modify properties at runtime

4 6-1 What Is Visual Basic .NET?
VB. NET is a modern development language that shares a syntax heritage with the BASIC language. VB. NET maintains Visual Basic’s tradition of excellence as the world’s most widely used tool for developing Windows applications.

5 6-1 What Is Visual Basic .NET? (cont.)
VB. NET was completely redesigned to be highly integrated with Microsoft’s .NET Framework. VB. NET is a full-fledged object-oriented programming language, making it comparable to C++, Java, Delphi, and C# in terms of developing object-oriented systems.

6 6-2 Using Visual Studio .NET
VB .NET applications are developed from within Visual Studio .NET. The development environment contains multiple windows and multiple functionalities and is called an integrated development environment (IDE).

7 6-2 Using Visual Studio .NET (cont.)

8 6-2 Using Visual Studio .NET (cont.)
The menubar contains File, Edit and Help plus some other options specific to Visual Studio. The standard toolbar gives icon shortcuts for frequently used menu commands. The layout toolbar provides icon shortcuts to commands for formatting layouts of forms and other objects.

9 6-2 Using Visual Studio .NET (cont.)
The middle of the screen is the Designer window, which contains forms being developed. The toolbox located on the left of the screen contains the controls you can add to the form. The Solution Explorer on the top right side of the screen typically contains one project, a references folder, an assembly file, and a form file.

10 6-2 Using Visual Studio .NET (cont.)
The Properties window on the bottom right side of the screen contains three parts: Combo box Properties list Description pane

11 6-3 Your First VB. NET Program: Hello World
Step 1: Add Button to Form

12 6-3 Your First VB. NET Program: Hello World (cont.)
Step 2: Set Properties

13 6-3 Your First VB. NET Program: Hello World (cont.)
Step 3: Add Code The Code Editor is where you enter, display, and edit your code. A comment is a descriptive note added to the code for documentation or explanatory purposes. An event procedure is code that is called in response to an event, such as a mouse click.

14 6-3 Your First VB. NET Program: Hello World (cont.)
Step 3: Add Code (cont.)

15 6-3 Your First VB. NET Program: Hello World (cont.)
Step 4: Run the Project

16 6-3 Your First VB. NET Program: Hello World (cont.)
Step 5: Save the Project

17 6-4 Windows GUI Visual Basic is the most widely used tool for developing Windows applications. Windows applications utilize a GUI that provides visual cues to the user that allow the user to work intuitively and efficiently. Windows applications contain WYSIWYG “What You See Is What You Get”

18 6-5 Working with Objects An object is anything we might use in our application for acquiring, manipulating, or presenting data or information. An object contains properties (data) and methods (actions for manipulating an object’s data). An object is defined once as a class.

19 6-5 Working with Objects (cont.)
The developer creates as many instances of the object as necessary for the application. The .NET class library is a large library of classes with reusable code included in the Microsoft .NET Framework. .NET uses namespaces, which are collections of related classes/ System.Windows.Form is the namespace containing classes for creating Window based applications.

20 Reuse and Reliability One of the most powerful features of object classes is that they are reusable. Objects can enhance reliability, which is the result of good design and lots of testing. Do not reinvent the wheel

21 6-6 Control Objects The Control class contains numerous properties and methods common to all controls for developing the user interface.

22 6-6 Control Objects (cont.)
The Button control is considered to be the most basic graphical control. The Label control is used to display text that cannot be edited by the user. The PictureBox control is used to display graphics. The Timer control is used to raise an event at user-defined intervals.

23 6-7 Working with Events Visual Basic supports event-driven programming in which the application recognizes and responds to events. An event is an action or occurrence recognized by some object and for which you can write code to respond. And event handler contains code that responds to a particular event.

24 Event Procedures The naming convention for an event procedure is the keyword Sub followed by the name of the triggering object followed by an underscore character followed by the name of the event: e.g. Sub frmMain_Click

25 Rem Statement Rem statements provide an explanatory remark in a program. Header comments occur at the beginning of a project file. Block comments appear above a block of one or more lines of code. Inline comments typically appear on the same line as a statement.

26 Rnd Statement The Rnd statement generates a single precision random value between 0.0 up to (but not including) 1.0. The Randomize statement is used to change the seed value (random sequence).

27 6-8 Project Development Process
Analysis stage The developer decides what kind of application and features he or she wants. Design stage The developer plans how to achieve the goals of the analysis stage. Implementation stage When the design is finished, the developer begins.

28 6-8 Project Development Process (cont.)
Maintenance stage Corrective maintenance Adaptive maintenance Enhancement maintenance

29 The Cost of Poor Planning
Fixing an analysis problem requires 3 times as much time and effort if not fixed until the design stage, 10 times as much time and effort if not fixed until the implementation stage, and 50 to 100 times if not fixed until the maintenance stage.

30 Testing and Documentation
Testing and documentation are essential activities for each stage of development. Testing at the analysis stage could be a series of “What if…?” questions. There is nothing wrong with adding features and functionality, but the developer should be compensated for the additions.

31 Chapter Summary Visual Basic is an object-oriented, event-driven language. An object is a self-contained entity that has both properties and methods. Windows forms are objects. Most of the objects you will need are available in VB. NET.

32 Chapter Summary (cont.)
An event refers to an action or occurrence detected by a program. An event procedure is the method that handles an event. The analysis stage determines what the solution needs to do. The design stage determines how the solution will do it.

33 Chapter Summary (cont.)
The implementation stage involves writing code to implement the design. The maintenance stage begins when the product is delivered. Testing and documentation are essential activities of every development stage.

34 Hands-on Introduction to Visual Basic .NET
6 Hands-on Introduction to Visual Basic .NET Programming Right from the Start with Visual Basic .NET 1/e


Download ppt "Hands-on Introduction to Visual Basic .NET"

Similar presentations


Ads by Google