0% found this document useful (0 votes)
1K views

Why VB Is Known As Event Driven Programming?

Event-driven programming is a paradigm where the flow of a program is determined by events like user actions or messages from other programs. Visual Basic uses an event-driven architecture with a main loop divided into event selection and event handling. The programmer adds event procedures that are called in response to specific events. Visual Basic is considered event-driven because the user-triggered events determine the flow rather than the program itself.

Uploaded by

Sourav Jash
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Why VB Is Known As Event Driven Programming?

Event-driven programming is a paradigm where the flow of a program is determined by events like user actions or messages from other programs. Visual Basic uses an event-driven architecture with a main loop divided into event selection and event handling. The programmer adds event procedures that are called in response to specific events. Visual Basic is considered event-driven because the user-triggered events determine the flow rather than the program itself.

Uploaded by

Sourav Jash
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

What is event Driven Programming?

event-driven programming or event-based programming is a programming paradigm in which the flow of the


program is determined by events—e.g., sensor outputs or user actions (mouse clicks, key presses)
or messages from other programs or threads.
Event-driven programming can also be defined as an application architecture technique in which the application
has a main loop which is clearly divided down to two sections:

 the first is event selection (or event detection)


 the second is event handling.

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.

Why VB is known as event driven programming?

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?

Why do we use option explicit?

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?

A do while loop executes when a condition is true. 


Ex. 
do while 1 = 1 
loop 
this would execute forever 
a do until executes until the condition is met. 
Ex. 
do until 1 = 1 
loop 
This would NOT execute. The program would see that 1 is in fact equal to 1 and does not perform the loop 
Note: "1=1" can be any conditional expression, not limited to what is shown

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.

What are dynamic and control arrays?

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. 

What is the purpose of the List Index property?


When a project is running and the user selects an item from the list, the index number of that item is stored
in the listIndex property of the listbox. The listindex of the first item in the list is zero. If no list item is
selected , the list index property set to -1. We can use listIndex property to select an item in list or deselect
all items in code.
Listbox supports this feature

lstCopyType.listIndex = 3

What is the difference between Sub-Procedure and Function-Procedure?

Function returns a value but procedure doesn't returns a value.

Function Addno()
Addno=5
End Function
Msgbox Addno

Sub Addno
c=5
End Sub
Call Addno

What is a Property Procedure?

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.

You might also like