visual basic 1
visual basic 1
QUESTION 1
(a) Describe the three most common properties of forms in Visual Basic. (6 Marks)
1. Name: Identifies the form; used in code to reference it. Default is Form1.
2. Text: The title displayed in the form's title bar. Can be modified in the properties window.
3. BackColor: Sets the background color of the form. Helps improve user interface aesthetics.
(b) Describe the menu editor as used in Visual Basic programming. (2 Marks)
The menu editor is a tool in Visual Basic used to create and manage menu systems for applications. It
allows developers to define menu items, assign shortcuts, and set properties like enabling/disabling
specific options.
(c) Distinguish between a method and a function as used in Visual Basic. (4 Marks)
Function: Returns a value after performing operations, e.g., Len() returns the length of a
string.
(d) Describe the three steps used when creating an application using VB. (6 Marks)
1. Design: Add and arrange forms, controls, and user interface elements.
3. Test/Debug: Run the program, fix errors, and ensure functionality aligns with requirements.
(e) Describe the two types of constants in Visual Basic with examples. (4 Marks)
(f) Describe the quickest way to reset the VB IDE layout. (4 Marks)
The quickest way is to go to the menu Tools > Import and Export Settings and choose "Reset All
Settings." Select the default environment layout and confirm.
TextBox: Accepts unrestricted input from the user, e.g., any text or numbers.
MaskedTextBox: Restricts input based on a predefined format, e.g., phone numbers (###-
###-####).
(a) Describe VB's IntelliSense feature and explain how it is accessed. (5 Marks)
IntelliSense is an auto-completion feature in Visual Basic that provides suggestions, parameter lists,
and documentation as you type. It’s accessed while coding by typing a dot (.) after an object or
pressing Ctrl + Space.
QUESTION 3
Objects:
Events:
Design-Time: Used for creating and modifying application layout and properties.
QUESTION 4
(a) Discuss properties, methods, and events of an object using a balloon example. (6 Marks)
1. optMale.Checked = True
2.
4.
6.
7. cboTest.Items.Add("Programming")
8.
9. txtCourses.Focus()
10.
(a) Write a program to calculate the sum of two numbers and display the result. (8 Marks)
End Sub
Return a + b
End Function
End Class
1. Explicit:
2. Dim x As Integer = 10
4. Dim x = 10
5. Static Variables: