Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6."— Presentation transcript:

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

2 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 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 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 3 Objectives (cont.) Understand and effectively use the Button, Label, and PictureBox controls Successfully write Windows applications that modify properties at runtime

4 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 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 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 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 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 6 6-2 Using Visual Studio.NET VB.NET applications are developed from within Visual Studio.NET or Visual Basic.Net Express. Each development environment contains multiple windows and multiple functionalities and is called an integrated development environment (IDE).

7 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 7 Which version will you use? In this course you will use Visual Basic Express 2005 This software will be made available for you to install and use on your home computers.

8 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 8 6-2 Using Visual Studio.NET (cont.)

9 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 9 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.

10 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 10 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.

11 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 11 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

12 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 12 6-3 Your First VB. NET Program: Hello World Step 1: Add Button to Form

13 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 13 6-3 Your First VB. NET Program: Hello World (cont.) Step 2: Set Properties

14 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 14 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.

15 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 15 6-3 Your First VB. NET Program: Hello World (cont.) Step 3: Add Code (cont.)

16 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 16 6-3 Your First VB. NET Program: Hello World (cont.) Step 4: Run the Project

17 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 17 6-3 Your First VB. NET Program: Hello World (cont.) Step 5: Save the Project

18 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 18 Submitting your projects First zip your projects by following the steps below. Open My Documents –Start --> My Documents Double Click on the Visual Studio 2005 folder Double Click on the Projects folder –This should give you a list of all projects stored on your machine.

19 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 19 Zipping your projects cont. Find the folder with the name of your project

20 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 20 Zipping your projects cont. Right Click on the folder with the name of your project and select Send To -> Compressed (zipped) folder

21 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 21 Zipping Concluded Your zip file with your project should now be in the Visual Studio 2005\Projects folder It’s name should match the name of the folder your project is stored in on the computer. –In this example the.zip file was name Hello World.zip

22 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 22 Uploading to Moodle When in Moodle go to the assignment that your code is for. Click the Browse button. Browse to the Visual Studio 2005\Projects folder and select your.zip file. Click ok Click Upload this file

23 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 23 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”

24 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 24 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.

25 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 25 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.

26 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 26 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

27 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 27 6-6 Control Objects The Control class contains numerous properties and methods common to all controls for developing the user interface.

28 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 28 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.

29 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 29 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.

30 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 30 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

31 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 31 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.

32 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 32 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).

33 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 33 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.

34 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 34 6-8 Project Development Process (cont.) Maintenance stage –Corrective maintenance –Adaptive maintenance –Enhancement maintenance

35 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 35 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.

36 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 36 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.

37 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 37 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.

38 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 38 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.

39 Crews/Murphy – Programming Right from the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall 39 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.

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


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

Similar presentations


Ads by Google