Visual Basic Programming

WellRoundedKremlin avatar
WellRoundedKremlin
·
·
Download

Start Quiz

Study Flashcards

40 Questions

What programming software will be used in Learning Module 3 for Computer Programming?

Microsoft Visual Basic 6.0

What technical skills are required for students in this module?

Basic Computer Programming

The character that is needed to break a long line of code into multiple lines is ________.

underscore

In Visual Basic programming, a textbox is used to select data to be displayed using Data Control.

True

What is the end goal of computer programming?

To create something

Which operating system supports the graphical interface needed for Visual Basic programs?

Windows

Visual Basic is text-oriented like Pascal and BASIC.

False

Computer programming involves writing ________ to give computers instructions.

code

Match the following Visual Basic versions with their descriptions:

Visual Basic Enterprise Edition = Created for team programming environments Visual Basic Professional Edition = Includes a full set of tools and wizards Visual Basic Learning Edition = Includes all essential features to get started programming

How many windows are included in a standard EXE project in Visual Basic?

Six

The Properties Window exposes the various attributes of selected objects in a form.

True

What is the purpose of the Toolbox Window in Visual Basic?

Selection menu for controls used in the Visual Basic application form at design time.

The _________ displays the project name, current Visual Basic operating mode, and the current form being worked on.

title bar

What window displays the description of the function of the chosen property?

Descriptive pane

In Visual Basic, what Windows is central to developing applications?

Form Designer Window

Which mode in Visual Basic is used to run or execute the application?

Run mode

The Form Layout Window shows the position of the form relative to the monitor’s screen upon program ____________.

execution

Match the following components with their descriptions:

Properties = Every characteristic of a form or a control that is specified by the property Methods = A built-in procedure that can be invoked to impart some action to a particular object Event Procedures = Codes related to some object that are executed when a certain event occurs Modules = A collection of general procedures, variable declarations, and constant definitions used by an application

What is the syntax for assigning a value to a variable?

Variable = Expression

What is a constant variable?

A variable whose value cannot be changed

Match the control names with their prefixes:

Form = frm Image Box = img Picture Box = pic Label = lbl Text Box = txt Frame = fme Command Button = cmd Checkbox = chk Option Button = opt Combo Box = cbo List Box = lst Horizontal Scroll Bar = hsb Vertical Scroll Bar = vsb Shape = shp Line = lin

What is the format referred to as when changing control properties using dot notation?

ControlName.Property = NewValue

What occurs during the Activate event in Visual Basic?

Forms get a focus

______ holds assignment statements for a control to perform a specific task or action.

Procedure

Red font color in Visual Basic indicates a syntax error.

True

What are the seven numeric data types with storage capacity mentioned in the content?

Byte, Integer, Long, Single, Double, Currency, Decimal

Which data type has a range from -3.402823x10^-38 to -1.401298x10^-45?

Single

Strings are used for calculations.

False

Variables are temporarily named storage areas inside the program’s ____________.

memory

Match the naming convention with its description:

Hungarian Notation = Variable names include the type and intended use Camel Case Notation = Compound words/phrases joined without spaces and capitalized within

What feature in the Visual Basic editor displays a list of possible choices of items as the character period (.) is pressed?

List Properties/Methods

What should be typed instead of typing the entire property 'Bold' when using the List Properties/Methods feature?

Property

What kind of modules are used in Visual Basic to store code?

Form Modules, Standard Modules, and Class Modules

Visual Basic follows the precedence of ____ (Exponentiation, Multiplication, Division, Addition, and Subtraction).

EMDAS

Arithmetic operators in Visual Basic include addition, subtraction, division, and exponentiation.

True

What prefix is used for Boolean data type in variable names for explicit declaration?

bln

Which prefix is used for Date data type in variable names for explicit declaration?

dte

What is the purpose of using Option Explicit in Visual Basic?

To force the user to declare all variables

Static variables in Visual Basic are reinitialized each time a procedure is invoked.

False

Variables declared with the _ keyword exist only as long as the procedure in which they are declared is being executed.

Dim

Study Notes

Module Overview

  • Learning Module 03: Computer Programming Using Visual Basic Language is an introduction to object-oriented programming and Visual Basic programming
  • Microsoft Visual Basic 6.0 will be used as the programming software to demonstrate coding and testing of the solution phase of the programming life cycle
  • Topics covered include Data Types, Variables, Arrays, Functions, Control and Repetition Structures, and Controls and their Properties

Learning Outcomes

  • Ability to manipulate the Visual Basic environment, its objects, and components, and database
  • Create a complex program with an engineering application

Minimum Technical Skills Requirement

  • Basic Computer Operation
  • Basic Computer Programming

Learning Management System

Duration

  • Topic 01: Introduction to Visual Basic Programming = 6 hours
  • Topic 02: Controlling Program Flow and Data Inputs = 15 hours
  • Topic 03: Enhancing Program and Object Management = 15 hours
  • Topic 04: Database Management = 15 hours

Delivery Mode

  • Onsite learning (face-to-face)
  • Online learning (synchronous)
  • Offsite learning (asynchronous)

Pre-Assessment

  • 20 points
  • Instructions:
    • Print on A4 bond paper
    • Write answers in the space provided
    • Post a captured/scanned image of the paper in Google Classroom
    • Erasures and abbreviations mean wrong
    • Keep work clean and avoid erasures
    • Use only a blue ballpoint pen

Course Packet 01: Introduction to Visual Basic Programming

  • Introduction to Integrated Development Environment (IDE) and basic objects and components
  • Objectives:
    • Identify parts and features of Microsoft Visual Basic 6.0 and their functions
    • Create and design basic gender-inclusive programs using Microsoft Visual Basic 6.0
  • Duration: 6 hours (4 hours self-directed learning and 2 hours assessment)
  • Delivery Mode: Onsite learning (face-to-face), online learning (synchronous), and offsite learning (asynchronous)
  • Assessment with Rubrics:
    • Calculation: 50%
    • Solution: 20%
    • Neatness: 10%
    • Formatting: 10%
    • Timeliness: 10%

Key Points

  • Computer programming is a way of giving computers instructions about what they should do next
  • It is a mix of art and science; technical and analytical, yet creative
  • Computer programming is the act of writing computer programs, which are a sequence of instructions written using a programming language to perform a specified task by the computer

Definition of Terms

  • Computer Programming: the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task
  • Computer Program: a collection of instructions that can be executed by a computer to perform a specific task### Debugging and Visual Basic
  • Debugging is the process of finding and resolving bugs or defects in computer programs.
  • Visual Basic 6.0 has three major versions: Enterprise Edition, Professional Edition, and Learning Edition.

Starting Visual Basic 6.0

  • When Visual Basic 6.0 is loaded, the New Project dialog box opens, allowing the user to create a new project.
  • The New Project dialog box has three tabs: New, Existing, and Recent.
  • The user can select Standard EXE and press Open to load the Visual Basic screen.
  • A standard EXE project contains at least six windows: Form Designer, Toolbox, Project Explorer, Properties, Form Layout, and Code Window.
  • The Main Window consists of the title bar, menu bar, and toolbar.
  • The menu bar has drop-down menus that control the operation of the Visual Basic environment.
  • The toolbar has a collection of icons that provide shortcuts to some of the menu options and carry out standard operations when clicked.
  • The menu bar and toolbar contain commands for developing, maintaining, and executing a program.
  • The menu bar contains a group of related capabilities from which the user may select appropriately.
  • The toolbar provides shortcuts to the commands from the menu bar.

Toolbox Window

  • The Toolbox Window is located on the left side of the Visual Basic screen.
  • The Toolbox Window is a selection menu for controls used in the Visual Basic application form at design time.
  • The default Toolbox Window displays the most common collection of toolbox controls or tools.
  • Additional controls can be included in the toolbox by using the Components menu item on the Project menu.

Toolbox Window Basic Components

  • Pointer: used to move and resize the form and its controls.
  • Picture Box: displays icons/bitmaps and metafiles, and displays text or acts as a visual container for other controls.
  • Label: displays text that the user cannot modify or interact with, commonly used as a caption to the function of a control.
  • Text Box: displays message and accepts input value from the end user.
  • Frame: serves as a visual and functional container for controls in groups.
  • Command Button: carries out a specified action when the user presses or clicks it.
  • Checkbox: provides the user with choices or options, displaying a True/False or Yes/No option.
  • Option Button: allows the user to select only one option, even if it displays multiple choices.
  • Combo Box: contains a text box and a list box, allowing the user to select an item from the dropdown list box or type in a selection.
  • List Box: displays a list of items from which a user can select one.
  • Horizontal Scroll Bar: allows the user to select a value within a specified range of values.
  • Vertical Scroll Bar: allows the user to select a value within a specified range of values.
  • Timer: executes timer events at specified intervals of time, not visible to the user at run-time.
  • Drive List Box: displays valid disk drives and allows the user to select and access one of them.
  • Directory List Box: displays directories and paths, allowing the user to select and access the desired one.
  • File List Box: displays a set of files from which a user can select and access the desired one.
  • Shapes: used to add or draw a shape to a form.
  • Lines: used to draw a straight line to the form.
  • Image Box: displays images such as icons, bitmaps, and metafiles, with less capability than the picture box.
  • Data: enables the user to connect to an existing database and display information from it.
  • Object Linking and Embedding: enables the user to link or embed an object, display, and manipulate data from other windows-based applications.

Project Explorer Window

  • The Project Explorer Window is located on the right side of the screen, just under the toolbar.
  • It serves as a quick reference to the various elements of a project, namely forms, classes, and modules.
  • It contains three buttons: View Code, View Object, and Toggle Folders.

Properties Window

  • The Properties Window is located under the Project Explorer window and above the Form Layout Window.
  • It exposes the various characteristics or attributes of selected objects in a form.
  • The drop-down box at the top of the window lists all objects in the current form.
  • The properties are viewed either in Alphabetic or Categorized order.

Form Layout Window

  • The Form Layout Window shows the position of the form relative to the monitor's screen upon program execution.
  • To use this window, click the form inside this window and drag it to the desired position.

Form Designer Window

  • The Form Designer Window is central to developing Visual Basic applications.
  • It is where the programmer draws the application.

Code Window

  • The Code Window is where the codes or procedures for an application are encoded.
  • The Object Box displays the name of the control that will trigger the event.
  • The Procedure Box specifies the type of event for the control.

Object Browser

  • The Object Browser allows the programmer to browse through the various properties, events, and methods that are made available.
  • It is accessed by selecting Object Browser from the View menu or pressing the F2 key or clicking the Object Browser icon in the toolbar.### Visual Basic Programming
  • Visual Basic operates in three modes: Design mode, Run mode, and Break mode.
  • Design mode is used to build an application, Run mode is used to execute the application, and Break mode is used to halt the application and make the debugger available for debugging or editing.

Structure of a Visual Basic Application

  • A Visual Basic application is made up of different parts, including:
    • Forms: windows that the programmer creates for the user interface
    • Controls: graphical features drawn on forms to allow user interaction (e.g., text boxes, labels, command buttons)
    • Properties: characteristics of a form or control that can be specified by the programmer (e.g., name, caption, size, color, position, contents)
    • Methods: built-in procedures that can be invoked to impart some action to a particular object
    • Event Procedures: codes related to some object that are executed when a certain event occurs
    • General Procedures: codes not related to objects that must be invoked by the application
    • Modules: collections of general procedures, variable declarations, and constant definitions used by an application

Steps in Developing a Visual Basic Application

  • Step 1: Draw the user interface
  • Step 2: Assign properties to controls
  • Step 3: Attach code to controls

Inserting Controls in a Form

  • To insert a control, double-click the control needed in the toolbox and it will be created with a default size on the form
  • To move a control, click the control in the toolbox, then move the mouse pointer to the form window, and press the left mouse button to drag the control to the desired location

Naming the Control

  • A control's name is a very important property that is used by Visual Basic to refer to a particular control
  • Control names can be up to 40 characters long, must start with a letter, and must contain only letters, numbers, and the underscore (_) character
  • Visual Basic provides a framework of event-driven procedures to add code to controls

Setting Control Properties

  • During Design Time, click on the object (form or control) in the form window, then click on the Properties Window, select the object from the Object box, and set the property value
  • During Run Time, properties can also be set or modified using the dot notation (e.g., ControlName.Property = NewValue)

Adding Code or Procedure to an Event

  • An Event is the user's action, and the Code is the statement that carries out the action when the event is triggered
  • Adding a code in an event is known as an event procedure
  • Example of an event procedure: Private Sub ControlName_Event (Optional Arguments)...End Sub

Control Event

  • Examples of control events include:
    • Activate: when the form gets focus
    • Click: when the user clicks the form or control
    • Initialize: when the form is first generated
    • Load: when the form is loaded into the computer's memory and displays on the screen
    • Resize: when the user changes the size of a form
    • Change: when the user changes the text inside a textbox

Syntax Errors and Font Color Scheming

  • Syntax errors occur when the rules of the programming language are violated
  • Visual Basic assigns specific colors to specific kinds of text:
    • Blue: Visual Basic commands (e.g., Private Sub, End Sub, If-Then-Else)
    • Black: control names and their properties
    • Green: comments
    • Red: syntax errors

This quiz assesses knowledge of computer programming using the Visual Basic language. It covers concepts and techniques in programming with Visual Basic.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Visual Basic Programming Overview
12 questions
Visual Basic Programming
10 questions

Visual Basic Programming

CreativeBrazilNutTree avatar
CreativeBrazilNutTree
Visual Basic Programming Quiz
5 questions
Use Quizgecko on...
Browser
Browser