Class 9 Exam  >  Class 9 Notes  >  Cyber Olympiad for Class 9  >  Visual Basic

Visual Basic | Cyber Olympiad for Class 9 PDF Download

Visual Basic

Visual Basic (also termed Visual Basic .NET or VB) is a major revision of earlier Microsoft VB products.

  • Thie latest version is Version 10 of VB.  
  • This is an upgrade to the earlier NET version. 
  • The current and earlier versions are not completely compatible—a program coded with an earlier version that is upgraded to the current version cannot be opened again earlier software version.  
  • Version 6 and earlier versions are not. NET-compatible. Programs created with these versions are completely incompatible with .NET applications.

VB is available in several editions including the free Express Edition that you can download from Microsoft. Other editions (Professional, Premium, and Ultimate) are used within the industry.

Visual Studio Components

When Visual Studio is installed on a computer, two mandatory components are necessary for installation and an optional third component.

NET Framework Class Library

This is a library of predefined class objects.  It enables you to quickly build a computer application through the use of predefined objects such as forms, text boxes, labels, buttons, dropdown list controls, etc.

Common Language Runtime (CLR)

This component manages the execution of a programming project written in any of the languages that are included within Visual Studio including Visual Basic as a language (mandatory).  This component is installed as part of the .NET Framework.

MSDN (Help)

This is the help component that provides access to a help reference library.  It is optional, but highly recommended component.

Object-Oriented Programming Terminology

VB is an object-oriented programming language.  It means you work with objects in building an application.
Examples: Form objects, Button objects, TextBox objects, Label objects, ListBox objects, PictureBox objects, and more.
VB has also termed an event-driven programming language because you will write program code that responds to the events that are controlled by the system user.
For example,

  • Clicking a button or menu. 
  • Opening or Closing a form. 
  • Moving the mouse over the top of an object such as a text box. 
  • Moving from one text box to another.

In order to work with VB, you need to understand ‘object’ terminology as defined in the following table.
Visual Basic | Cyber Olympiad for Class 9
Getting Started with Visual Studio

The VB component of Visual Studio can be used to create and test projects.

  • The programming applications used to design and develop are called solutions in VB. 
  • A solution can actually contain more than one project.  
  • Each solution is stored in a folder identified by the solution name.

Launching Visual Basic

To start VB, Click the Windows Start button and locate Microsoft Visual Studio 2010, click the button to launch the program.
The first screen to display may require you to choose your Default Environment Settings.

  • If this screen displays, click the Visual Basic Development Setting option in the list box and then click the Start Visual Studio button 
  • This is the Start Page for Visual Basic 2010 Express Edition. 
  • Click the New Project link.  This opens the New Project dialog box. 
  • If your first project is Visual Basic Project using a Windows Forms Application template, the default name will be Windows Application1. You can change it. 
  • Click the OK button – it takes a few seconds to create the project files from the template.

The Integrated Development Environment

Familiarize yourself with the Integrated Development Environment (IDE).

  • Across the top are menus with different options used in the designing of an application. 
  • Toolbars with shortcut icons are shown below the menus.  
  • Form Designer (also termed the Document Window).

The GUI with the points given below:

  • Displays open documents.  
  • Tabs along the top allow you to switch rapidly between open documents. 
  • Every project starts with a default form named Form1 – the form you modify to build your business application.  
    • The form can be resized by using the sizing handles. 
    • The form can be renamed. 
  • Solution Explorer Window displays file names for the files that comprise a project. 
  • Properties Window displays properties of the currently selected object.

The Toolbox

  • Contains controls that are used to build forms.  
  • Can be expanded or collapsed with the Pin/Unpin icon. 
  • Parts of the Toolbox can be expanded/ collapsed with the white and black pointer icons to the left of the groupings. 
  • Adds controls (tools) to a form by either double-clicking or dragging/dropping (your option on which to use).

Naming Rules and Conventions

Visual Basic automatically assigns a value to the Name property of each control, for example, Label1, Label2, Label3, or TextBox1, TextBox2, TextBox3, or Button1, Button2, Button3.  However, it is difficult to remember the difference between Label1 and Label2.
Therefore:

  • if you are going to later refer to the controls, it is best to rename them to a more meaningful name, 
  • if you are not going to refer to the controls later, then just use the assigned default name such as Label1.

When you name an object such as a Label or TextBox or Button, you must follow these rules:

  • An object's name can begin with a letter or the special ‘underscore’ character.
  • An object name can include letters, digits, and underscores. 
  • An object name CAN NOT include a space or a punctuation mark. 
  • An object name CAN NOT be a VB reserved word such as Button, Close, or TextBox. 
  • An object name can contain a VB reserved word –like as PrintButton,

Close Button, Name Text Box, and Major Text Box are legal names.

Name and Text Properties

As you have seen already, forms, labels, text boxes, and buttons have numerous properties.  The name property is used to name control for your reference.  For example, names such as display button or exit button.

  • Notice that the name begins with a word that describes the control – you will often use the text on a control such as a button as part of the control’s name.  
  • The type of control such as Button or TextBox is added to the name to create a unique name.  
  • Text boxes may be named NameTextBox and MajorTextBox, or some other meaningful name.  
  • If you are not going to refer to a control in the project, you can just use the default name assigned by VB. 
  • Text property is used to display text values on a control.  
  • The Text property for a form displays the words that are displayed in the form’s Title Bar.  
  • The Text property of a button displays the words on the button, such as Display or Exit.   Using the ampersand causes a letter on a button to be underlined. 
  • The Text property for a text box control displays the actual words typed into the text box.

Locking Controls

After you finish sizing control on a form, you can lock the controls to prevent accidental movement of the controls.

  • Right-click any control and select the Lock Controls option in the context menu that displays as shown in the figure below. 
  • Right-click again and select Lock Controls to unlock the controls.

Switching Between the View Designer and View Code Windows Often you will need to switch between the View Designer and View Code windows.  
The different ways to do this are:

  • Click one of the tabs to display either the View Designer or View Code windows. 
  • Click the View Code icon in the Solution Explorer to open the coding window.
  • Click the View Designer icon in the Solution Explorer to display the form for additional design layout. 
  • Click the View menu and select either the Code or Designer submenu options.

Design Time, Run Time, Break Time

There are some additional terms for you to learn about designing and executing a VB program.

  • Design Time: when you are designing a project using the IDE, you are in what is termed Design Time. 
  • Run Time: when you execute or run a project, you are in Run Time.  
  • Break Time: It occurs whenever VB encounters any processing error that prevents program execution from continuing.
The document Visual Basic | Cyber Olympiad for Class 9 is a part of the Class 9 Course Cyber Olympiad for Class 9.
All you need of Class 9 at this link: Class 9
7 videos|27 docs|69 tests

Top Courses for Class 9

FAQs on Visual Basic - Cyber Olympiad for Class 9

1. What is Visual Basic?
Ans. Visual Basic is a high-level programming language developed by Microsoft. It is widely used for creating graphical user interface (GUI) applications. Visual Basic provides a simple and easy-to-understand syntax, making it suitable for beginners in the field of programming.
2. What are the main features of Visual Basic?
Ans. Some of the main features of Visual Basic include a drag-and-drop interface for designing forms, automatic memory management, integrated development environment (IDE), support for object-oriented programming (OOP) concepts, and access to the .NET Framework libraries.
3. How can I create a GUI application using Visual Basic?
Ans. To create a GUI application using Visual Basic, you can use the drag-and-drop functionality provided by the IDE. You can design the user interface by adding various controls such as buttons, text boxes, labels, etc., to your form. Then, you can write code to define the behavior and functionality of these controls.
4. What is the .NET Framework in Visual Basic?
Ans. The .NET Framework is a software development framework provided by Microsoft. It includes a large library of pre-built classes and functions that developers can use to build applications. Visual Basic is a language that runs on the .NET Framework, which provides access to various functionalities like file I/O, database connectivity, and networking.
5. Can Visual Basic be used for web development?
Ans. Yes, Visual Basic can be used for web development. With the introduction of ASP.NET, developers can use Visual Basic to create dynamic web applications. ASP.NET allows you to write server-side code using Visual Basic and integrate it with HTML, CSS, and JavaScript to build interactive web pages.
7 videos|27 docs|69 tests
Download as PDF
Explore Courses for Class 9 exam

Top Courses for Class 9

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

practice quizzes

,

Previous Year Questions with Solutions

,

Exam

,

mock tests for examination

,

Viva Questions

,

Objective type Questions

,

Visual Basic | Cyber Olympiad for Class 9

,

Extra Questions

,

video lectures

,

Free

,

ppt

,

Summary

,

Visual Basic | Cyber Olympiad for Class 9

,

Visual Basic | Cyber Olympiad for Class 9

,

Semester Notes

,

Sample Paper

,

past year papers

,

pdf

,

study material

,

shortcuts and tricks

,

MCQs

,

Important questions

;