VISUAL BASIC REVISION
1. Define a Graphical User Interface (GUI) and explain its importance in creating
user-friendly applications.
2. List and describe the purpose of any five common objects found in the Visual
Basic toolbox (e.g., Label, Button, Textbox).
3. Describe the difference between the "Recent" projects list and the "New
Project" dialogue in the Visual Studio interface.
4. Write a Visual Basic program segment that: declares two variables for the
price and quantity of an item, calculates the total cost, and uses a conditional
statement to apply a 10% discount if the total cost is greater than 50,000
UGX. [4 marks]
5. What is the purpose of the Toolbox in the Visual Basic development
environment?.
6. Explain the role of the Dim statement in Visual Basic programming.
7. Differentiate between Numeric and Non-Numeric data types, providing two
examples for each.
8. Write the code required to declare two numeric variables and assign them
values representing a product's price and quantity.
9. Describe the use of Suffixes and Literals in variable declaration.
[Link] four arithmetic operators used in Visual Basic and provide their symbols
[Link] TWO errors your program should guard against and explain how you
would handle each.
[Link] the structure of an If...Then...ElseIf...Else statement using a practical
example, such as checking a student's grade.
[Link] the structure of a standard Event Procedure in Visual Basic.
[Link] how to code a Message Box that includes a title, a specific message,
and "Yes/No" buttons.
[Link] is the significance of the Information Icon when designing a message
box for a user?.
[Link] the process of debugging and correcting errors in a Visual Basic code
snippet.
[Link] a simple program logic that displays "Hello World" in a message box
when a user clicks a button.
[Link] how a "Clear" button can be coded to reset text in a textbox to an
empty string.
[Link] the steps to connect a Visual Basic interface to an external database
management system.
Practical Revision Questions
1. Interface Design & Basic Event Handling: Design a form that contains a Label,
a Textbox, and a Button. Write a code procedure for the Button’s Click event
so that when it is clicked, the text entered in the Textbox is displayed in a
Message Box with the title "User Input".
2. Arithmetic Operations Create an application with two textboxes for a user to
enter two numbers. Add a button labeled "Calculate Sum". Write the code to
declare two numeric variables using the Dim statement, assign the textbox
values to these variables, and display the total sum in a third (read-only)
textbox.
3. Conditional Logic (Grade Checker) Develop a program where a user enters a
student's marks (0-100) into a textbox. Use an If...Then...ElseIf...Else structure
to display "Distinction" if marks are 80 or above, "Credit" if marks are
between 60 and 79, and "Pass" for marks between 50 and 59.
4. Logical Operators & Validation Write a login procedure that checks a
username and password. Use the And logical operator to ensure that the
message "Access Granted" only appears if the username is "Admin" and the
password is "1234". If either is incorrect, show a Message Box with an
Information Icon saying "Access Denied".
5. Control Properties & Customization Create a program that allows a user to
change the interface's appearance. Add two buttons: "Night Mode" and "Day
Mode". Write code so that "Night Mode" changes the form’s BackColor to
Black and all Labels' ForeColor to White, while "Day Mode" resets them to
their default colors.
6. Business Logic Application (Profit Calculator) Develop a "Profit Calculator"
application. The interface should allow users to input "Cost Price" and
"Selling Price". Write the logic to calculate the profit (Selling Price - Cost Price)
and display the result. If the result is negative, display the value in red text to
indicate a loss.
7. Advanced Message Box Interaction Code a "Close Application" button that,
when clicked, triggers a Message Box with Yes and No buttons asking, "Are
you sure you want to exit?". Write the logic so the application only closes if
the user clicks "Yes".
8. Database Integration Preparation Outline and write the basic connection
string and code steps required to connect a Visual Basic form to an external
Database Management System (DBMS) like MS Access to save user-captured
data.
9. Event-Driven Timer (Stopwatch) Using a Timer control and a Label, create a
simple stopwatch. Write the code to increment the label's value by 1 every
second when a "Start" button is clicked and stop the incrementing when a
"Stop" button is clicked