You are on page 1of 10

1. What is a Visual Basic Event? What are mouse events?

Each action by the user causes an event to occur in project .this action performed is called event.

Types: mouse events , keyboard events, focus events

2. What are the logical operators in VB ?

Logical operators are used to generally combine two or more checking conditions of statements.

Eg : AND, OR, NOT, XOR

3. Explain any two common properties of VB controls.

Height : specifies the height of the control

Width : specifies the width pf the control

4. Explain dynamic array with syntax.

There will be a situation when the user may not know the exact size of the array at design time.
Under such circumstances, a dynamic array can be initially declared and can add elements when
needed instead of declaring the size of the array at design time

Syntax : ReDim [Preserve] varname (Subscripts) [As type] [,varname(subscripts) [As type]]..

5. What is a function procedure?

Function procedure are like sub-procedure. They can take arguments, perform a series of
statements. Unlike a sub-Procedure, a function-procedure can return a value to the calling
procedure.

6. Explain Date Time Picker control in VB.

DateTimePicker control is used To present date information where restricted or specially formatted
field is required such as date of birth field in online registration form. Here the users can select a
date with the click of a mouse instead of typing a date.

7. What is MDI form? Explain.

An application is referred to as Multiple Document Interface, or MDI, if the user open more than one
document in the application without closing it. To provide this functionality, the application provides
a parent frame that acts as the main frame of the computer program. Inside of this frame, the
application allows creating views that each uses its own frame, making it distinct from the other.

8. Write a note on checkbox control.

The Check Box control lets the user to select or deselect an option. When the Check Box is checked,
its value is set to 1 and When check Box is unchecked, the value is set to 0.

9. What is ODBC? Explain.

Open Database Connectivity (ODBC) is a standard developed by Microsoft in order to simplify the
development of applications that need to be independent of database platforms.
10. What are Help files?

Help system (help files) is a documentation component of a software program that explains the
features of the programs. It helps the user understand its capabiliti

11. What is MFC? Explain.

MFC is short for Microsoft Foundation Classes. It is Microsoft's Win 32 application framework for
writing Microsoft C/C++ and Visual C++ applications and is made up of a collection of classes written
in C++.

12. What are DLLS? Explain.

A dynamic-link library (DLL) is an executable file that acts as a shared library of functions linking
provides a way for a process to call a function that is not part of its executable code.

5 marks
13. a) Explain different Do Loops used in VB with syntax.
Do While.. Loop Statements :A Do While Loop is used to execute statements as long as the
condition is true.
Syntax:
Do While <condition>
Statements
Loop
Do Loop... While Statements: A De Loop While Statement first executes the statements and
then tests the condition after each execution.
Syntax:
Do
statements
Loop While <condition>
Do Until ...Loop Statements:Do Until...Loop Statement are similar to Do While loop but the
Keyword UNTIL (means as long as) the comparison test is NOT TRUE, the loop repeats. As
soon as it becomes TRUE, the loop terminates
Syntax:
Do Until <condition>
Statements
Loop
Do loop until:The Do.Loop Until structure executes the statements until the condition is
satisfied. It is an infinite loop if the test fails and to get released from this infinite loop only
by pressing CTRL+ BREAK key.
Syntax:
Do
statements
Loop Until <condition>

b) Explain any five string operations in VB.


Right Function: The Right function extracts the right portion of a phrase.
The format is Right ("Phrase", n)
Where n is the starting position from the right of the phase where the portion of the phrase
is going to be extracted.
For example,
Right (" Visual Basic", 4)= Vasic
The Left Function:The Left function extract the left portion of a phrase.
The format is Left("Phrase", n)
Where n is the starting position from the left of the phase where the portion of the phrase
is going to be extracted.
Example:
Left ("Visual Basic", 4) = Visu
The Ltrim Function:The Ltrim function trims the empty spaces of the left portion of the
phrase.
The format is Ltrim("Phrase")
Example:
Ltrim ("Visual Basic", 4)= Visual Basic
The Rtrim Function:The Rtrim function trims the empty spaces of the right portion of the
phrase. The format is
Rtrim("Phrase")
Example:
Rtrim ("Visual Basic “,4)=visual basic
The Trim function:The Trim function trims the empty spaces on both side of the phrase.
The format is
Trim("Phrase")
Example:Trim (" Visual Basic ") = Visual Basic

14. a) Explain combobox control and how to add items to combobox during design time
and run time.
Combo boxes are so-named because they "combine" the features found in both text boxes
and list boxes. This enables the user to select either by typing text into the Combo Box or by
selecting an item from the list. Combo boxes are also commonly referred to as "drop-down
boxes" or "drop-down lists"
Addings items
▸ At Design Time: To add items to a list at design time, click on List property in the property
box. Then add the items by Pressing CTRL+ENTER and end by pressing ENTER button.
At Run Time: The AddItem method is used to add items to a list at run time.
Syntax: Object.AddItem <item, Index>
Where
Item: A string that represents the text to add to the list
Index: The Index argument is an integer value assigned to data items.

b) Write notes on Drive Listbox, Directory Listbox and File Listbox.


Three of the controls on the ToolBox lets the user to access the computer's file system.
They are DriveListBox, DirListBox and FileListBox controls., which are the basic blocks for
building dialog boxes that display the host computer's file system.
Using these controls, user can traverse the host computer's file system, locate any folder or
files on any hard disk, even on network drives.
The DriveListBox
▸ The DriveListBox control is a combo box-like control that's automatically fill with the
names of the drives within when connected to the PC.
> The basic property of this control is the drive property, which set the drive to be initially
selected in the control or returns the user's selection.
The DirListBox
▸ The DirListBox is a special list box that displays a directory tree.
▸ It Displays the folders of current Drive.
> The basic property of this control is the Path property, which is the name of the fo whose
sub folders are displayed in the control.
File list box
The FileListBox control is a special-purpose ListBox control that displays all the files in a
given directory, optionally filtering them based on their names, extensions, and attributes.
Displays the files of the current folder.
The basic property of this control is also called Path, and it's the path name of the folder
whose files are displayed.
These controls often work together on the same form; when the user selects a drive in a
DrivelistBox, the DirListBox control is updated to show the directory tree on that drive.

15. a) What are Modules? Explain different types of Modules.


The code that we write in VB is actually stored in MODULES. A module basically is collection
of some procedures and definitions. Module is a code container that contains some
procedures and definitions.
There are three kinds of modules in VB
1. Form Modules
2. Standard Modules
3. Class Modules
Form Modules
A simple application may contain a single form, and the code resides in the same is called as
Form module. Basically a form module is a module that stores all the procedures and
declarations pertaining to single form.
The form modules can contain procedures that handle events (i.e. event procedures).
The form modules are saved with extension FRM extensions.
Standard Modules
As the applicationgrows,additional Formsareadded and there maybeacommon codetobe
executed in several forms. To avoid the duplication of code, a separate module containing a
procedure is created that implements the common code. They are stored with the extension
.BAS
Class Modules
Class module are the foundation of the object oriented programming in Visual Basic and
defines an object class. New objects can be created by writing code in class modules. Each
module can contain: Declarations, constant, type, variable and DLL procedure declarations.
A class module is a blueprint of custom objects. Each class module can only contain one
class that defines everything about the new object. So Visual Basic object is as a self-
contained piece of code and data.
To create a class module, choose the class module option from Add class module dialog box.
Then the normal coding techniques are used to add code to the module.
A class module is saved with the extension. CLS

b) Explain common dialog control with suitable example.


Here we examine the Windows Common Dialogs, which provide a powerful and professional
set of dialog boxes for interacting with the user across all Windows programs.
The Common Dialog control is not an intrinsic control, rather, it is an "Active X" control that
must be added to the toolbox via the Components dialog box, as shown below.
Once checked on, "Microsoft Common Dialog Control 6.0" and click OK. The control is added
to toolbox (also shown below, circled). Then double-click it to make it appear on the form,
as with any other control. The Common Dialog control is not visible at run-time.
The Common Dialog control provides a standard set of dialog boxes for operations such as
opening, saving, and printing files, as well as selecting colors and fonts and displaying help.
Methods of common dialog are, ShowOpen - displays the open dialog box, ShowSave
displays saveAs dialogbox, ShowColor displays color dialog box, ShowFont - displays fonts
dialog box, ShowPrinter - displays printer dialog box, ShowHelp - displays Windows help.
EXAMPLE
Private Sub cmdbackcir_Click() CommonDialog1.ShowColor
Text1.BackColor CommonDialog1.Color
End Sub
Private Sub cmdfont_Click()
CommonDialog1.Flags = cd/CFBoth
CommonDialog1.ShowFont
Text1.Font = Common Dialog1.FontName Text1.FontSize = Common Dialog1.FontSize
Text1.FontItalic = Common Dialog1.FontItalic
Text1.FontBold Common Dialog1.FontBold
End Sub
Private Sub cmdforeclr_Click() Common Dialog1.ShowColor
Text1.ForeColor = CommonDialog1.Color
End Sub
16. a) Write notes on Windows API viewer.
The Windows API are a collection of routines available to the user/programmers. API
routine work just like visual Basic's own internal functions and calls it when needed, when
windows API finishes, control returns back to the program so that it can continue.
For Example many Windows API routine exist and from visual basic application appropriate
windows API routines can be called. System can be made to reboot by dialing windows API
routine.Windows API routines are stored in special files called DLL's. These routines appear
in files stored in windows or system folders
DLL files gets installed automatically when windows are installed in systems which gives
easy access to these libraries.
A DLL or Dynamic link library is a collection of small programmes which can be called when
needed by a larger programme that is running in a computer. The small programme lets the
larger program to communicate with a specific device. For example a printer or scanner is
packged as a DLL program that support specific defice operation known as device drivers.
DLL files have the file name .dll and .exe extension.
b) Explain data abstraction and encapsulation in VB.
As programs grow in size and become more complex, and as the number of programmers
working on the same project increases, the number of dependencies and interrelationships
throughout the code increases exponentially. A small change made by one programmer at a
place may have effects on flow throughout the entire program. This may require the
rewriting of the code. The concept "Data hiding" is the solution to the problem where
details of implementation are hidden.
Encapsulation it is also called information hiding. All data stored inside cannot be directly
accessed by another part of the application and all assignment and retrieval operations are
performed through methods and properties provided by the object itself. VB allows to
declare attributes and behaviours with the Private keyword inside a class module. This hides
class from the world outside of the class. Conversely, if declared with the Public keyword
other objects can access those properties and methods yet know nothing of their actual
implementation.
Data abstraction is a simplified view of an object that includes only features interested in,
while hides away the unnecessary details. In programming languages, a data abstraction
becomes an abstract data type or a user-defined type. In OOP, it is implemented as a
class.Classes use the concept of abstraction and are defined as a list of abstract
attributes.Storing data and functions in a single unit becomes encapsulation. Data cannot
beaccessible to the outside world and only those functions which are stored in the class can
access it
17. a) Write notes on file handling.
Many programs in existence today use files. Whether a program saves data into a database
or just keeps information for its own use, most programs do relay on files. These files can be
stored by computer on secondary storage devices, such as hard disk drives, magnetic disks
and drives and optical disk.
There are three main ways to access files in Visual Basic: as sequential files, as random
access files, and as binary files.
Sequential files
Sequential files are like tape cassettes. Data is read in a sequential order
A sequential file is a file that is read and written in order from beginning to end. To use the
file, entire file is processed from beginning to end. If it is needed to update one byte of
information in a 1,000-byte file, 999 bytes must be performed every time to update.
Random Access Files
A random access files are similar to CDs. Random access file is a file whose data can be read
or written in any order without having to read or write all the intervening data in the file and
move to that record in a file directly lime a CD track
For example, customer records can be written to a random access file and then read one or
more customer records in any order needed by the user
Binary Files
Binary files are simply unformatted binary data. It is the compacted form of random file. In
Visual Basic files are not understood as text strings or consolidate the contents into records.
But these files are just bytes to visual basic.
b) Explain DAO (Data Access Objects).
DAO enables you to use a programming language to access and manipulate data in local or
remote databases and to manage databases, their objects, and their structure. It supports
two different database environments, or "workspaces".Microsoft jet workspaces allow to
access data in Microsoft jet databases, Microsoft jet connected ODBC databases, and
installable ISAM data sources in other formats, such as Paradox of Lotus 1-2-3.
Microsoft JET WORKSPACE:WorkSpace is used to access the data source by using the
Microsoft jet database engine. The data source can be a Microsoft jet database file (.mdb),
an ODBC database, such as a paradox database or an ISAM database.
Microsoft JET Database:A Microsoft jet database is a database created with the Microsoft
jet database engine.The file name extension for a Microsoft jet database is .mdb.
MS JET Database engine:A database management sytem that retrieves and stores data
from the user and system databases. The Microsoft jet database engine can be thought of as
a data manager component with which other data access systems, such as Microsoft Access
and VisualBasic, are built.

18. a) Write notes on Record set.


A recordset object represents the records in a base table or the records that result from
running a query
Recordset objects are used to manipulate data in a database at the record level. DAO
objects use recordset objects to manipulate data.
Types:
Table-type recordset Representation in code of a base table that can use to add, modify, or
delete records single database table
Dynaset-type recordset The result of a query can have updatable records. A dynaset-type
recordset is a Dynamic Set of records that can use to add, delete, or change records an
underlying database table or tables. A dynaset-type recordset object can contain fields from
one or more tables in a database
Snapshot-type recordset A static copy of a set of records that can use to find data or
generate reports. A snap shot type recordset object can contain fields from one or more
tables but cannot be updated.
Forward-only-type recordset Identical to snapshot. It can scroll forward through records.
This is useful when you need a single pass through a result set is needed.
Dynamic-type recordset A query result set from one or more base tables can add, change,
or delete records from a returning query. Further, records other users add, delete, or edit in
the base tables, also appear in recordset.
b) What is ADODC? What are the features of ADODC?
>The ADO (ActiveX Data Object) data control is the primary interface between a Visual Basic
application and a database.
An ADO data control defines the recordset for a Form and provides functions for navigating,
displaying, adding and updating records.
> ADO data control contains the four navigation buttons From left to right, these buttons let
to move to the First, previous, next and Last records in the underlying recordset.
> The data control is used to add records to the recordset. By setting EOFAction property of
the Data control to adDoAddNew. Then, when the user clicks on the navigation. button to
move to the next record and the Last record is already displayed, a new blank record is
added.
▸ When the user clicks on one of the navigation buttons to move to another record, the
current record is automatically updated if the data in any of the bound controls has been
changed.If the user closes the form before moving to another record, though the changes.
are lost. Some functions, like deleting records, are not built into the data control. To provide
for these functions, VB code are written.

You might also like