Presentation is loading. Please wait.

Presentation is loading. Please wait.

Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1.

Similar presentations


Presentation on theme: "Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1."— Presentation transcript:

1 Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1

2 Chapter 1 The Visual Basic Integrated Development Environment: The form and code windows; The standard toolbar; The solution explorer windows; The Toolbox; The properties window. Creating the Visual Basic Project

3 3 Creating the Project First thing to do is to create a Directory where you will store all your VB Projects. Call it VBApps, for example. Then start VB. The first screen will ask whether you want to open a new project or an existing one. Choose a new one. Now, save your project. It will first ask you to save the form - call it Score.frm - and then the Project - call it Scorebrd.vbp. Do File-->Save Project very frequently.

4 Exploring the Environment 4 Menus and Toolbars The Toolbox Windows Forms Designer Editor Properties Window Other Programming Windows Online Help System Practice: Working in the Development Environment

5 Lesson agenda 5 After completing this lesson, you will be able to: Use the main menu and standard toolbar to open, build (debug and release modes), run, save, and close an existing Visual Basic application. View user interface forms in the Windows Forms Designer or the Code Editor. Use the Toolbox to add a button and a label to a form. Use the Properties window to view and set properties. Open, close, and reopen programming tools and windows.

6 Menus and Toolbars 6 Main menu When you start a Visual Basic project and select an application template, the visual development environment appears. The main menu and standard toolbar provide access to most of the commands that control the Visual Basic programming environment. Commands on the main menu work as they do in all Windows-based applications, and you can access them by using the keyboard or the mouse.

7 Menus and Toolbars 7 Standard toolbar The standard toolbar provides buttons that serve as shortcuts for most of the common commands, such as Open, Save, Start, Add New Item, Navigate Backward, and Navigate Forward. It also contains buttons that open Solution Explorer, the Properties window, the Toolbox, and other key elements in the development environment.

8 8 The Toolbox You create the user interface objects for your application by adding controls from the Toolbox to a form. The Toolbox is initially located on the left side of the development environment. There are several tabs for different categories of controls, such as Windows Forms and Data. The Toolbox contains a variety of controls that you can use to add artwork, labels, buttons, list boxes, scroll bars, menus, and geometric shapes to a user interface. Each control you add to a form becomes a programmable user interface object in your application. These objects are visible to users when the application runs and operate like the standard objects in any Windows-based application.

9 Windows Forms Designer 9 When you start a project in Visual Basic, the Windows Forms Designer opens in Design view, showing Form1 of the project. You place controls from the Toolbox on the form to create the user interface for a window used in your application. Elements of a form The default form contains the minimum elements used by most forms: a title bar, a control box, and Minimize, Maximize, and Close buttons. Viewing a form To view a form in Design view In Solution Explorer, double-click the form.. Or. In Solution Explorer, select the form and click the View Designer button on the toolbar.

10 Code Editor 10 How the Code Editor works Visual Basic provides a Code Editor in which you write and maintain the code for your project. You can associate code directly with a form in your project or place it in a separate code module. A separate Code Editor is displayed for each form or module in your project, making it easy to organize, view, and move through the code.

11 11 Code Editor The Code Editor contains two drop-down lists at the top of the window: the Class Name list on the left and the Method Name list on the right. The Class Name list shows all the controls on the associated form. If you click a control name in the list, the Method Name list shows all of the events for that control. (Events are actions that the control can perform and that can be interpreted by your application.) By using the Class Name and Method Name lists together, you can quickly locate and edit the code in your application. Opening the Code Editor To open the Code Editor for a form 1. In Solution Explorer, click the form for which you want to view code. 2. On the Solution Explorer toolbar, click the View Code button. Or On the View menu, click Code.

12 Properties Window 12 Opening the Properties window The Properties window lists the property settings for the selected form or control that you can modify while you are creating or editing the application. A property describes a characteristic of an object, such as size, caption, or color. To open the Properties window If the Properties window is not visible, click Properties Window on the View menu, or press F4.

13 Properties Window 13 Viewing properties Some controls, documents, and forms display a large number of properties in the Properties window. This can make it difficult to locate the property you want to set. The Properties window allows you to view the properties for a form or control in a categorized view instead of an alphabetic view. To view properties 1. To view the properties by category, click the Categorized button in the Properties window. The properties for the selected form or control will be separated into categories defined by the control. 2.To view the properties in a category, expand the category node. To hide the properties in a category, collapse the category node. 3.To view the properties alphabetically, click the Alphabetic button in the Properties window.

14 14 Before you start to build-up the form, it will make it easier if you change the color of the form. Otherwise you will be working with grey controls on a grey background. To change the color, just click anywhere on the form, go to the properties window, find the property called BackColor and change it to the standard Window background (teal) or to any color you want in the palette.

15 15 In our first example we will need 6 labels and 2 command buttons. Each one of these objects that you put on a Form is called a control. To get a control you go to the Toolbox, click on the control you want, come back to the Form and click and drag the control to the size and position you want. Position the controls somewhat like in the diagram below.


Download ppt "Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1."

Similar presentations


Ads by Google