Working with the Visual Studio IDE
In the next steps, you use the IDE to create a Form with a Button and a Label. Your first console application in Chapter 1’s “You Do It” section displayed “Hello, world!” at the command prompt. This application displays “Hello, Visual World!” on a Form.
1.
Open Microsoft Visual Studio. You might have a desktop shortcut you can double- click, or in Windows 10 you can type the first few letters of Visual Studio in the “Ask me anything” search box, and then select it from the list of choices. Your steps might differ slightly from the ones listed here if you are using a different version of Visual Studio or a different operating system. If you are using a school network, you might be able to select Visual Studio from the school’s computing menu. Once you open Visual Studio, if the initial display looks like the following image, then select the link in the lower right corner that says “Continue without
code”.
2.
Within Visual Studio, select File from the main menu, then New and Project. Then, in the New Project window, scroll through the options along the right side of the screen until you find Windows Forms App (.NET Framework). Double check that the programming language is C# and not Visual Basic or F# (See the image below for a reference). Then click Next.
Instead of using the default project name, use HelloVisualWorld, and select a location to store the project on your computer or thumb drive (Notice the path specified in the Location on the screen print below as “C:\MTSU Classes\INFS 2600\”; in other words, in this example the HelloVisualWorld app will be stored in a folder named “INFS 2600” located within the “MTSU Classes” folder on the C:\ drive of the computer). Then click Create.
3.
The HelloVisualWorld development environment opens, as shown in Figure 3-16 in your textbook. The text in the title bar of the blank Form contains the default text Form1. If you click the Form, its Properties window appears in the lower- right portion of the screen, and you can see that the Text property for
the Form is set to Form1. Take a moment to scroll through the list in the Properties window, examining the values of other properties of the Form. For example, the value of the Size property is 300, 300 by default.
Figure 3-16
The HelloVisualWorld project development environment
If you do not see the Properties window in the lower-right corner of your screen, click the title bar on the Form. Alternatively, press F4 or click View in the menu bar and then click Properties Window. If you do not see the Toolbox shown
in Figure 3-16, click the Toolbox tab at the left side of the screen, and then click the pushpin near the top to pin the Toolbox to the screen. Alternatively,
click View from the menu bar and then click Toolbox. If you do not see the error list at the bottom of the screen, as in Figure 3-16, you can select View from the menu bar and then select Error List. You might have to drag up the divider that separates the error list from the window above it.
4.
In the Properties window, change the Name of the Form to HelloForm.
(The Name property is under Design if you choose to have the list categorized; if you choose to display it alphabetically, then Name is near the top.) Then change the Text of the Form to Hello Visual World. Press Enter; the title of the Form in the center of the screen changes to Hello Visual World.
5.
Examine the Toolbox on the left side of the screen. Select Common Controls if it is not already selected. In the Toolbox, click and hold Button. As you move your mouse off the Toolbox and onto the Form, the mouse pointer changes so that it appears to carry a Button. Position your mouse anywhere on the form, then
release the mouse button. The Button appears on the Form and contains the text button1. When you click the Button, handles appear that you can drag to resize it. When you click off the Button on the Form, the handles disappear.
Click the Button to display the properties for button1. Change
its Name to displayOutputButton, and change its Text property to Click here. When you press Enter on the keyboard or click anywhere on the Form, the text of the Button on the Form changes to Click here. You can adjust the size of
the Button so you see its full text by dragging its handles.
6.
Scroll through the other displayOutputButton properties. For example, examine the Location property. The first value listed for Location indicates horizontal position, and the second value indicates vertical position. Drag
the Button across the Form to a new position. Each time you release your mouse button, the value of the Form Button’s Location property is updated to reflect the new location. Try to drag the Button to Location 80, 50.
Alternatively, delete the contents of the Location property field and type 80, 50. The Button moves to the requested location on the Form.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of