Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
with one .frm file for each form. A from holds the description of all objects and their properties
for each form, as well as the basic code that you have written to respond to the events. These
are also referred as form modules.
.bas file: Optionally your project can have this file. These file holds basic statements that can
be accessed from any form. As soon as you begin .bas file are called standard code modules.
.ocx file: additional controls, called custom controls, are stored with a file .ocx extension. If you
include controls in your projects that are not part of the standard control set, the .ocx file names
will be included in the project.
.vbw file: After you save a project, Visual Basic automatically adds one more file to your project
with extension of .vbw. This file holds information about each projects form.
Q4. When is Visual Basic in design time? Run time? Break time?
Ans:
Visual Basic has three distinct modes.
While you are designing the user interface and writing code, you are in design time.
When you are testing and running project, you are in run time.
If you get an error or pause project execution, you are in break time
Q5. What is purpose of name property of control? ( 4 mrks )
Ans:
Every control has its properties one of the common properties of controls is name property.
Name property is the one by which the control is identified and it is referred as the object name
of that control.
By using name property programmer can access the other properties of the controls and
methods as well at run time.
Visual Basic gives default name to the controls which can be later changed by changing its
name property at the design time or urn time.
Q6. Which property determines what appears on the form for Label control.
Ans:
Caption property of the Label control determines what will appear on the Label control.
This Caption property is changed at run time or design time.
Use can not change the Caption property of the Label control.
Q7. What is the purpose of the Caption property of the Command button? And Caption
property of the Form?
Ans:
Command button has a Caption property which is used to display a text on the top of Command
Button.
Form object also has the Caption property. This property displays the Caption text at the title bar
of the window.
This property can be changed run time or design time. But it cant be changed directly by the
end user.
Q8. What does cmdPush_Click() mean? To what does cmbPush refer? To what does
Click refer?
Ans:
Visual Basic is event driven programming language. Over here cmdPush_Click() is a event
procedure, which belongs to cmdPush command button object.
Visual Basic automatically names your event procedures. The name consist of the object name,
an underscore(_), and the name of event. For example: the click event of command button
The editor might find compile errors as you move of offending line. Or the compile error may not
be found until you try to run the project. Before Visual Basic can actually run your project, it
attempts compile the code into machine language. If VB finds compile errors, it displays Code
window, highlights the offending line, and enters break time.
After you have corrected your compile errors, you can click on run button to continue the
compilation and running project.
Q13. What is run time error, when does it occur, and what might it cause it?
Ans:
If your project halts during execution, thats a run-time error. Visual Basic displays a dialog box,
goes into break time, and highlights the statement causing.
The statement that cannot be executed correctly cause run-time errors. The statements are
correctly formed Basic statement fail to execute.
Run time error can be caused by attempting to do impossible
arithmetic operation such as calculate with non-numeric data, divide by zero, or find the square
root of negative number.
Q14. What is logical error, when does it occur, and what might it cause it?
Ans:
With logical errors your projects runs but produces incorrect results. Perhaps the result of a
calculation are incorrect or the wrong text is OK but appears in wrong location.
If the project runs, it must be right-right? All too often, that statement is not correct. You may
need to use calculator to check the output. Check all aspects of the project.
For example, the you want to print hello world but you are giving some incorrect message at the
wrong place it will not give out put as you expected and it causes the logical error to solve these
kinds of errors you must check the code carefully.
Q15. Tell the class of control and the likely purpose of these object names:
Ans:
(a) lblAddress:
lblAddress is object of Label control class which is named as lblAddress. It is used to
display text on to the Label control.
(b) cmdExit:
cmdExit is object of Command Button control which is named as cmdExit. It is used
when you want user to perform some action.
(c) txtName:
txtName is object of TextBox control which is named as txtName. It is used to take
inputs from the user.
(d) optTextBlue:
optTextBlueis object of Option button control class which is named as optTextBlue and it
is used to user to select one option from several options.
Q16. When does context-sensitive help mean? How can you use it to see the Help page
for a command button? ( 6 mrks )
Ans:
A quick way to view Help on any topic is to use context-sensitive Help.
Select a VB project, such as form or control, or place the insertion point in word in the editor,
and press F1. The MSDN library viewer will open on correct page, if possible, saving your
search.
If you want need a help about command button just place the cursor on the command button
and press F1 key. This will open page with command button help page from MSDN library.