Why VB Is Known As Event Driven Programming?
Why VB Is Known As Event Driven Programming?
Visual Basic is based upon an event-driven paradigm, in which each feature included within the program is
activated only when the user responds to a corresponding object (i.e., an icon, a checkbox, an option button, a
menu selection, etc.) within the user interface. The programmer adds code to respond to specific events, and
only events that are relevant to a program need be coded.The group of Basic commands that brings about this
response is called an event-procedure.
When you program in vb ,you must first decide how the application interacts with the user.in other words you
must decide how each control reacts to user actions,such as the click of a mouse,keystrocks and so on.and
you must program this reactions.vb is as event driven programming language because the application does not
determine the flow,instead the events caused by the user determine the flow of the application.
What are the common controls we use in VB and for what purposes?
Option Explicit forces the programmer to declare all variables, rather than letting them be implicitly declared
upon their first use. This enforces good programming practices and avoids ambiguity of variable scope.
What do you mean by Object Based programming language?
Programming language that uses the idea of encapsulating state and operations.in visual basic there is a tool
box ,in which there are gui elements like textbox,checkbox,we directly use them without knowing the details
how they are implemented. vb supports both objects and class but not inheritance so it does not qualify for
object oriented programming language but it is a object based programming language.
What are the principal differences between Do While and Do Until Loop?
How do List Boxes and Combo Boxes differ from each other?
The function of the List Box is to present a list of items where the user can click and select the items from the
list. In order to add items to the list, we can use the AddItem method. The function of the Combo Box is also to
present a list of items where the user can click and select the items from the list. However, the user needs to
click on the small arrowhead on the right of the combo box to see the items which are presented in a drop-
down list. In order to add items to the list, you can also use the AddItem method.
A dynamic array can be resized at any time. Dynamic arrays are among the most flexible and convenient
features in Visual Basic, and they help you to manage memory efficiently. For example, you can use a large
array for a short time and then free up memory to the system when you're no longer using the array.
Dim DynArray()
ReDim DynArray(X + 1)
Control array
Similar to arrays of variables, you can group a set of controls together as an array. Control array is always a
single dimensional array. Control array is that you can add or delete array elements at run-time. With some
controls, it is very useful to define control arrays - it depends on the application.
ControlName(Index)[.Property]
Why do we use Preserve?
Each time you execute the ReDim statement, all the values currently stored in the array are lost. Visual Basic
resets the values to the Empty value (for Variant arrays), to zero (for numeric arrays), to a zero-length string
(for string arrays), or to Nothing (for arrays of objects).
This is useful when you want to prepare the array for new data, or when you want to shrink the size of the array
to take up minimal memory. Sometimes you may want to change the size of the array without losing the data in
the array. You can do this by using ReDim with the Preserve keyword.
lstCopyType.listIndex = 3
Function Addno()
Addno=5
End Function
Msgbox Addno
Sub Addno
c=5
End Sub
Call Addno
A property procedure is a series of Visual Basic statements that manipulate a custom property on a module, class, or
structure. Property procedures are also known as property accessors.