1 / 33

Microsoft Visual Basic 2005 BASICS

Microsoft Visual Basic 2005 BASICS. Lesson 2 Forms, Controls, and Properties. Objectives. Create a new Visual Studio 2005 project. Save a Visual Studio 2005 project. View and modify form properties. Create controls, such as command buttons. Objectives (cont.).

headk
Download Presentation

Microsoft Visual Basic 2005 BASICS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Microsoft Visual Basic 2005 BASICS Lesson 2 Forms, Controls, and Properties

  2. Objectives • Create a new Visual Studio 2005 project. • Save a Visual Studio 2005 project. • View and modify form properties. • Create controls, such as command buttons. Microsoft Visual Basic 2005 BASICS

  3. Objectives (cont.) • Move, resize, and delete objects. • Explain the concept of focus. • Set additional properties (BackColor, Top, and Left). Microsoft Visual Basic 2005 BASICS

  4. Creating a New Project • Create a new project • Select the New Project option • From the File menu • Or push the New Project button • On the Start Page Microsoft Visual Basic 2005 BASICS

  5. Creating a New Project (cont.) Microsoft Visual Basic 2005 BASICS

  6. Creating a New Project (cont.) Microsoft Visual Basic 2005 BASICS

  7. Forms • Forms are the windows and dialog boxes when the program runs. • Every program must have at least one form. • All other objects must be contained within forms. Microsoft Visual Basic 2005 BASICS

  8. Forms (cont.) Microsoft Visual Basic 2005 BASICS

  9. Forms (cont.) Microsoft Visual Basic 2005 BASICS

  10. Saving the Project • Visual Basic will save your project whenever you compile the program. • Use the Save All button • To save your project manually Microsoft Visual Basic 2005 BASICS

  11. Viewing and Modifying Properties • The Properties window • Allows you to easily alter the properties of objects • Important properties of a form • The Text property specifies the text that appears in the title bar. • The Name property names the object for coding. Microsoft Visual Basic 2005 BASICS

  12. Viewing and Modifying Properties (cont.) Microsoft Visual Basic 2005 BASICS

  13. Viewing and Modifying Properties (cont.) • Naming objects • Use names that are meaningful and that describe the object you are naming. Microsoft Visual Basic 2005 BASICS

  14. Viewing and Modifying Properties (cont.) Microsoft Visual Basic 2005 BASICS

  15. Creating Controls • Controls are the objects that make up the user interface. • One of the most common controls is the command button. • To create controls, you must access the Toolbox. Microsoft Visual Basic 2005 BASICS

  16. Creating Controls (cont.) Microsoft Visual Basic 2005 BASICS

  17. Creating Controls (cont.) Microsoft Visual Basic 2005 BASICS

  18. Setting Properties of the Command Buttons • Command buttons • Have many properties that can be set • Text property • Specifies the text that the user sees on the command button • Name property Microsoft Visual Basic 2005 BASICS

  19. Moving, Resizing, and Deleting Objects • Objects can be moved and resized. • Using techniques common to most Windows programs • Delete an object • Select the object and press the Delete key. • Snap lines • Colored lines • Help you line objects up with one another Microsoft Visual Basic 2005 BASICS

  20. Moving, Resizing, and Deleting Objects (cont.) Microsoft Visual Basic 2005 BASICS

  21. Moving, Resizing, and Deleting Objects (cont.) Microsoft Visual Basic 2005 BASICS

  22. Understanding Focus • The object that is currently active on the screen is said to have the focus. • Press the Tab key • To move the focus from one control to another • Each object in a window will get the focus in a sequence. • Called the tab order Microsoft Visual Basic 2005 BASICS

  23. Setting Additional Properties • Other properties commonly set when creating Visual Basic programs • BackColor • Position and size of objects Microsoft Visual Basic 2005 BASICS

  24. Setting the BackColor Property • By default, forms have a gray background. • Use BackColor property • To change form background color • Collections of colors • System colors • Web colors • Custom colors Microsoft Visual Basic 2005 BASICS

  25. Setting the BackColor Property (cont.) Microsoft Visual Basic 2005 BASICS

  26. Setting the Top and Left Properties • Use Location property • For precise placements of objects • Location property • Point with X and Y values • Locates the object at a distance from the upper-left corner of a form • By default, the unit of measure is pixels. • Smallest dot on a screen that the computer can address Microsoft Visual Basic 2005 BASICS

  27. Summary • To create your own Visual Basic program, you must create a new project. The Windows Application project template allows you to create a program from scratch. • Projects created using the Windows Application template begin with one blank form. Forms become the windows and dialog boxes when the program runs. Microsoft Visual Basic 2005 BASICS

  28. Summary (cont.) • Every program has at least one form. All other objects must be contained within forms. • Visual Studio 2005 will save your project whenever you compile the program. Microsoft Visual Basic 2005 BASICS

  29. Summary (cont.) • A window created from a Visual Basic form has certain functionality by default, such as the ability to be moved, resized, maximized, minimized, and closed. • Properties are the characteristics of Visual Basic objects. Properties can be modified in the Properties window. Microsoft Visual Basic 2005 BASICS

  30. Summary (cont.) • The Text and (Name) properties are two of the most important properties. The Text property controls what the user sees in the title bar of a form and in other objects, such as command buttons. Microsoft Visual Basic 2005 BASICS

  31. Summary (cont.) • When we add programming code later, the (Name) property allows us to refer to the object using a meaningful name. Programmers often use a naming standard when naming objects. • Controls are the command buttons, text boxes, scroll bars, and other objects that make up the user interface. Microsoft Visual Basic 2005 BASICS

  32. Summary (cont.) • A command button is a standard push-button control that commonly appears in dialog boxes. Command buttons can be moved, resized, and deleted like other Windows objects. • Focus refers to the active status of one of the objects in a window. Only one object can have the focus. Microsoft Visual Basic 2005 BASICS

  33. Summary (cont.) • The BackColor property controls the background color of a form. • The Location property can be used to accurately position objects. By default, the X and Y point values of the Location property use a measurement called pixels. Microsoft Visual Basic 2005 BASICS

More Related