VISUAL BASIC CAT GROUP 1
MEMBERS
JESCA TRACY 51784
RAYMOND KARIUKI 34330
BORE EMMANUEL 43900
VISION MUSICHA 39295
STANLEY CHEGE 43137
QUESTION
1.(a) A program developer used the break mode interface during program debugging in a visual basic
program. Explain three activities the developer is likely to perform in this interface
In Visual Basic, the "break mode" interface is commonly used during program debugging to pause the
execution of a program at a specific point in order to inspect the state of variables, step through code,
and diagnose issues. Here are three activities a developer is likely to perform in this interface:
1. Inspecting Variables : One of the primary activities in break mode is inspecting the values of variables
at the current point in the program's execution. Developers can examine the values of variables to check
if they hold the expected data or to identify any unexpected changes. This can help pinpoint logic errors
or incorrect data manipulation within the code.
2. Stepping Through Code : While in break mode, developers can step through the code line by line to
understand how the program is executing and to identify any errors or unexpected behavior. By stepping
through the code, developers can trace the flow of execution, check conditional statements, and ensure
that control is moving through the program as expected. This allows them to identify the exact point at
which an issue arises.
3. Modifying Code : In break mode, developers can also make changes to the code while the program is
paused. This can involve making corrections to fix bugs, adding logging or debugging statements to
gather more information, or experimenting with different approaches to solve the problem at hand.
After making changes, developers can continue running the program to see if the modifications resolve
the issue or if further adjustments are needed.
(b) The sum of the first 20 terms of the following series is to be computed. 7,17,27,37........ write a
visual basic program that uses a function to compute the sum of the series and display the result in a
message box, use while loop control structure and attach the code to a command button.
Private sub command1_click()
Dim result As integer
Msg box“The sum of the first 20 terms of the series is:” &result
End sub
Private function computeseriessum() as integer
Dim sum as integer
Dim term as integer
Dim count as integer
Sum=0
Term=7
Count=1
While count<=20
Sum=sum+term
Term=term+10
Count=count+1
Wend
Computesseriessum=sum
End function
(c) State two difference between standard module and form module as used in a visual basic program.
STANDARD MODULE FORM MODULE
Used to define global variables, constants and Associated with individual forms in the
procedures that can be accessed from anywhere application, they contain code specific to the
within the project and are typically used for utility form they belong to including user interface logic.
functions.
Have global scope and exist for the entire lifetime Have a local scope and are tired to the lifetime of
of application thus available through the entire the form they belong to.Variables and procedures
project declared are accessible only within that specific
form and are destroyed when the form is closed.