Download presentation
Presentation is loading. Please wait.
Published byPhyllis Johns Modified over 9 years ago
1
CSC 157 (Blum)1 Hello World
2
CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003
3
CSC 157 (Blum)3 Start Page Tabs: My Profile
4
CSC 157 (Blum)4 Start Page Tabs: Projects
5
CSC 157 (Blum)5 New Project Dialog Box
6
CSC 157 (Blum)6 Name the Project
7
CSC 157 (Blum)7 Browse for a Location
8
CSC 157 (Blum)8 Use Look in Drop-down box to select a location for your project
9
CSC 157 (Blum)9 Click on the Create New Folder button to make a folder for your project
10
CSC 157 (Blum)10 Enter a Name in the New Folder Dialog Box
11
CSC 157 (Blum)11 Click Open
12
CSC 157 (Blum)12 Click OK
13
CSC 157 (Blum)13 Designing a Form
14
CSC 157 (Blum)14 Place the mouse over the Toolbox icon to display the Toolbox
15
CSC 157 (Blum)15 Click on the tack icon to display the Toolbox continually
16
CSC 157 (Blum)16 Change the programming name of the form by editing the text in the (Name) textbox in the Properties Window Properties Window
17
CSC 157 (Blum)17 Right click on the Form icon in the Solution Explorer and choose Rename
18
CSC 157 (Blum)18 Here we are changing the name of the file that contains the code we will write. It is tradition for it to have the same name as the Form (class). Solution Explorer
19
CSC 157 (Blum)19 Right click on project icon in the Solution Explorer and choose Properties.
20
CSC 157 (Blum)20 Find the newly named file in the Startup object drop-down list, then click OK.
21
CSC 157 (Blum)21 Click on the form in the design tabpage to bring back its Properties Window, then edit the Text property. The form in design.
22
CSC 157 (Blum)22 Form The form is like a window. Think of it as a container of the other items belongs to your graphical user interface (GUI). –Technical point: we are creating a form class, usually one must instantiate a specific object of a generic class. But if there is only one form this is done automatically for you.
23
CSC 157 (Blum)23 A look at what has been generated thus far in Windows Explorer
24
CSC 157 (Blum)24 Click on the Button icon in the toolbox
25
CSC 157 (Blum)25 Drag the cursor (it should appear as the button icon and cross hairs) from the upper left to the lower right of the desired position of the button
26
CSC 157 (Blum)26 Change the button’s (Name) property in the Properties Window
27
CSC 157 (Blum)27 Controls and Hungarian Notation The button is our first example of a control. Controls are the items placed on a form (usually visible) with which the user interacts. Visual Basic programming typically uses a notation scheme known as Hungarian Notation for naming controls. –The names of controls start with a prefix that describes the type of control. –The rest of the control’s name hints at its purpose in the program. The first letter of the second part of the name is capitalized.
28
CSC 157 (Blum)28 Edit the textbox corresponding to the Text property of the button.
29
CSC 157 (Blum)29 Click on the Label icon in the toolbox
30
CSC 157 (Blum)30 Drag the cursor from the upper left to the lower right of the desired position of the label
31
CSC 157 (Blum)31 Change the label’s (Name) property in the Properties Window – the Hungarian prefix for label is lbl
32
CSC 157 (Blum)32 Click on the ellipsis button for the font dialog box
33
CSC 157 (Blum)33 Use the Font dialog box to change the font size and click OK
34
CSC 157 (Blum)34 Clear out the text property of the label
35
CSC 157 (Blum)35 Double click on the Message button
36
CSC 157 (Blum)36 This open up a FrmHello code tabpage and provides the first and last line of the btnMessage_Click method
37
CSC 157 (Blum)37 Event Driven Programming We are writing event-driven code. An error is when something happens. Examples include: –The user clicking a button –The program clock reaching a certain value –The system running out of memory allotted to the program –Etc.
38
CSC 157 (Blum)38 Inside the button’s click event method, start entering the code that will display a message. Type the name of the label and a dot.
39
CSC 157 (Blum)39 Typing the dot should yield a drop-down list of label properties and methods, double click on the text property.
40
CSC 157 (Blum)40 Finish typing the assignment statement.
41
CSC 157 (Blum)41 Assignment statements Assignment statements direct the computer to evaluate the right-hand side and then to set the value of the property on the left-hand side to that value. The right-hand side of the statement in this case is a literal string – that “Hello World”
42
CSC 157 (Blum)42 Add comments. Comments start with an apostrophe. They do not affect the way the program executes, but help someone to read the code.
43
CSC 157 (Blum)43 Click on Build/Build Solution
44
CSC 157 (Blum)44 Click Debug/Start
45
CSC 157 (Blum)45 The executing program prior to the user’s clicking the button.
46
CSC 157 (Blum)46 The executing program after the user’s clicking the button.
47
CSC 157 (Blum)47 Close the program by clicking the button
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.