Presentation is loading. Please wait.

Presentation is loading. Please wait.

Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.

Similar presentations


Presentation on theme: "Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment."— Presentation transcript:

1 Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment

2 Chapter 3: Building an Application in the Visual Basic.NET Environment 2 Objectives Design a Visual Basic.NET application Start a new Visual Basic.NET project Change the size of a form Change the property values of a form Add controls to a form

3 Chapter 3: Building an Application in the Visual Basic.NET Environment 3 Objectives Move and resize controls on a form Use the Label, TextBox, NumericUpDown, and Button controls Change the property values of controls Change the Name property to rename a control Write the code for a Click event procedure

4 Chapter 3: Building an Application in the Visual Basic.NET Environment 4 Objectives Display line numbers in the code window Use control properties in a method Document code with a comment header and comment statements

5 Chapter 3: Building an Application in the Visual Basic.NET Environment 5

6 6 Program Development

7 Chapter 3: Building an Application in the Visual Basic.NET Environment 7 Starting a New Project Start Visual Basic.NET. When the Start Page displays, click the New Project button on the Start Page Click the More button Click the Create directory for Solution check box. Double-click the text, WindowsApplication1, in the Name box. Type State Tax Computation in the Name box

8 Chapter 3: Building an Application in the Visual Basic.NET Environment 8 Starting a New Project Click the Browse button. If necessary, select 3½ Floppy (A:) in the Look in box. Double-click Chapter3 in the Look in list Click the Open button Click the OK button and, if necessary, click the Maximize button on the Visual Basic.NET title bar to maximize the window

9 Chapter 3: Building an Application in the Visual Basic.NET Environment 9

10 10 Changing the Size of a Form Click the Form1 form in the main work area. Point to the center sizing handle on the form’s right border Drag the form’s right border to the left to decrease the form width by approximately one- half inch Point to the center sizing handle on the form’s bottom border and then drag the form’s bottom border up to decrease the form height approximately one-half inch

11 Chapter 3: Building an Application in the Visual Basic.NET Environment 11

12 Chapter 3: Building an Application in the Visual Basic.NET Environment 12 Using the Property Window Object Box Property List Toolbar –Categorized button –Alphabetic button –Properties button –Property Pages button Description Pane

13 Chapter 3: Building an Application in the Visual Basic.NET Environment 13 Changing StartPosition, Title, and FormBorderStyle Property Values

14 Chapter 3: Building an Application in the Visual Basic.NET Environment 14 Changing StartPosition, Title, and FormBorderStyle Property Values Click the title bar of the Form1 form to select the form. Scroll the Properties list until the FormBorderStyle property displays Click the Sizable value next to the FormBorderStyle property. Click the FormBorderStyle box arrow next to the value, Sizable

15 Chapter 3: Building an Application in the Visual Basic.NET Environment 15 Changing StartPosition, Title, and FormBorderStyle Property Values Click Fixed Dialog in the FormBorderStyle property values list Scroll down to the Text property, and double-click the Form1 value next to the Text property Type State Tax Computation as the Text property and press the ENTER key

16 Chapter 3: Building an Application in the Visual Basic.NET Environment 16 Changing StartPosition, Title, and FormBorderStyle Property Values Scroll the properties list to the StartPosition property and click the WindowsDefaultLocation value next to the StartPosition property Click the StartPosition box arrow and select CenterScreen in the values list

17 Chapter 3: Building an Application in the Visual Basic.NET Environment 17 Changing Additional Form Property Values

18 Chapter 3: Building an Application in the Visual Basic.NET Environment 18 Adding Label Controls to a Form Click the Windows Forms tab in the Toolbox window, and point to the Label button Click the Label button and point to the upper-left corner of the form Drag the mouse pointer down and to the right to size the Label control Release the mouse button Click any blank area on the Form1 form

19 Chapter 3: Building an Application in the Visual Basic.NET Environment 19 Adding TextBox Controls to a Form Point to the TextBox button in the Toolbox window Drag the TextBox button to the right without releasing the mouse button Release the mouse button Add a second TextBox control to the form, along with 2 more labels

20 Chapter 3: Building an Application in the Visual Basic.NET Environment 20 Adding a NumericUpDown Control to a Form Click the down scroll arrow in the Toolbox window until the NumericUpDown button displays on the Windows Forms sheet Drag the NumericUpDown button to the right of the Form1 form Click any blank area on the Form1 form

21 Chapter 3: Building an Application in the Visual Basic.NET Environment 21 Adding Button Controls to a Form Double-click the Button button in the Toolbox window Add a second Button control to the form Click and drag the controls to position them as shown on the following slide

22 Chapter 3: Building an Application in the Visual Basic.NET Environment 22

23 Chapter 3: Building an Application in the Visual Basic.NET Environment 23

24 Chapter 3: Building an Application in the Visual Basic.NET Environment 24 Changing Properties of Controls Single-click the control for which you wish to change the properties In the Property window, scroll down to the property you wish to change and type or select the property value next to the property name Set the properties of your controls according to the tables on the following slides

25 Chapter 3: Building an Application in the Visual Basic.NET Environment 25

26 Chapter 3: Building an Application in the Visual Basic.NET Environment 26

27 Chapter 3: Building an Application in the Visual Basic.NET Environment 27

28 Chapter 3: Building an Application in the Visual Basic.NET Environment 28

29 Chapter 3: Building an Application in the Visual Basic.NET Environment 29 Changing the Name Property of Controls Name property Naming conventions

30 Chapter 3: Building an Application in the Visual Basic.NET Environment 30 TextBox and NumericUpDown Control Methods Event-driven program Events are messages sent to an object –Click event Event procedures, triggered by events, are groups of code statements Code statements are instructions to the computer written at design time for the computer to execute at run time

31 Chapter 3: Building an Application in the Visual Basic.NET Environment 31 Assignment Statements controlname.propertyname=propertyvalue

32 Chapter 3: Building an Application in the Visual Basic.NET Environment 32 Comment Statements

33 Chapter 3: Building an Application in the Visual Basic.NET Environment 33 Writing Code in the Code Window Intellisense anticipates your needs during coding and displays prompts to assist you in coding A syntax error is an error caused by code statements that violate one of the structure or syntax rules of the Visual Basic.NET language

34 Chapter 3: Building an Application in the Visual Basic.NET Environment 34 Showing Line Numbers and Writing Code for a Comment Header and the btnCompute_Click Event Procedure Select Options from the Tools menu on the menu bar and click the Text Editor folder in the Options dialog box Click the Basic folder below the Text Editor folder and click Line numbers in the Display area Click the OK button

35 Chapter 3: Building an Application in the Visual Basic.NET Environment 35 Showing Line Numbers and Writing Code for a Comment Header and the btnCompute_Click Event Procedure Double-click the Compute Tax button on the Form1 form in the main work area Type the five comment header lines (excluding line numbers) as shown below

36 Chapter 3: Building an Application in the Visual Basic.NET Environment 36 Showing Line Numbers and Writing Code for a Comment Header and the btnCompute_Click Event Procedure On the blank line below the word, Private, type lines 142 and 143 of code, as shown below Click the Form1.vb[Design] tab

37 Chapter 3: Building an Application in the Visual Basic.NET Environment 37 Writing Code for the btnReset_Click Event Procedure Double-click the Reset button on the Form1 form in the main work area Enter the code below Click the Form1.vb[Design] tab

38 Chapter 3: Building an Application in the Visual Basic.NET Environment 38 Saving and Testing the Application Click the Save All button on the Standard toolbar Click the Start button on the Visual Basic.NET Standard toolbar Click the Minimize button on the Visual Basic.NET title bar. Type 50000 in the Taxpayer’s income text box and then select the number 3 for the number of dependents Click the Computer Tax button

39 Chapter 3: Building an Application in the Visual Basic.NET Environment 39 Click the Close button on the application and Maximize the Visual Basic.NET window

40 Chapter 3: Building an Application in the Visual Basic.NET Environment 40 Documenting the Application and Quitting Visual Basic.NET Close the Output window. Click the Form1.vb[Design] tab and use the PRINT SCREEN key, along with your knowledge from Chapter 2, to record the user interface design Click the Form1.vb tab. Click File on the menu bar and then click Page Setup

41 Chapter 3: Building an Application in the Visual Basic.NET Environment 41 Documenting the Application and Quitting Visual Basic.NET Use the Print command on the File menu to print a record of the code of the State Tax Computation form Click the Visual Basic.NET Close button

42 Chapter 3: Building an Application in the Visual Basic.NET Environment 42 Summary Design a Visual Basic.NET application Start a new Visual Basic.NET project Change the size of a form Change the property values of a form Add controls to a form

43 Chapter 3: Building an Application in the Visual Basic.NET Environment 43 Summary Move and resize controls on a form Use the Label, TextBox, NumericUpDown, and Button controls Change the property values of controls Change the Name property to rename a control Write the code for a Click event procedure

44 Chapter 3: Building an Application in the Visual Basic.NET Environment 44 Summary Display line numbers in the code window Use control properties in a method Document code with a comment header and comment statements

45 Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Complete


Download ppt "Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment."

Similar presentations


Ads by Google