Nothing Special   »   [go: up one dir, main page]

VB MLM

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 41

ALPHA ARTS AND SCIENCE COLLEGE

PORUR CHENNAI -116

DEPARTMENT OF BCA & IT

SUBJECT: VISUAL BASIC

UNIT-I

PART A

TWO MARK QUESTIONS:

1. Write a note on: Toolbox in Visual Basic Environment.


Ans: Toolbox is one of the important tool in the Visual basic, it is always shown on
the left hand side of the VB window, it consists of 21 icons or tools. Each control in
the tool box is used to design the form in a creative manner.

2. What are labels?


Ans: The Labels are one of the tools in the tool box and it is used to label the contents
of the form, which is also used to give the proper heading to the forms. It has the
following symbol in the tool box A

3. What is the use of print method? Give its general syntax.


Ans : The Print method in VB is used to print the contents directly in the form
instead of the text box or any other controls in the tool box.

Syntax: print “message”.

4. List down the Relational Operators in Visual Basic.


Ans: The Relational operators are really used in VB to compare the two operands
together. The relational operators that are used in Vb are greater than, less than, equal
to, greater than equal to, less than equal to.

5. Write a note on: Command Button.


Ans: The Command button is one of the important control in VB, the command
button is used to do the calculation in the form, it is consists of so many events, it sia
always used to do some action to take place in the VB. The Command button consists of
the default events as Click event.

6. What are Image Controls?


Ans: The Image control is one the control in Vb, The image control is really used
to add the images in the form, it is available in the tool box in the VB window. The size
of the image can be adjusted to the size of the image.

7. What is the use of Project Explorer Window?

1
Ans: The Project explorer window is used to show the form and projects that are
created in the particular project. This window is always shown in the right top of the
window.

8. What are the properties of Command Buttons? List them.


Ans: The properties of the command button are name, caption, forecolor, back color,
font, size, and graphics and so on. It totally consists of 32 properties.
9. What are variables in VB?
Ans: The variable is nothing but the values that an be changed during the execution of
the program. The variable can be declared as follows
Dim variable name as data type.

10. How to find out the length of a string?


Ans: The length of the given string can be finding with the help of the Len function in
vb, which will return the length of the given string. E.g.: Len (“hello”)

11. What is mean by properties window?


Ans: The properties window is always shown in the right side of the window, when a
control is placed in the form and if it is selected, automatically the properties are
displayed in the property window.

12. Write about name property.


Ans: The Name property is one of the important property in VB, all the
controls in tool box consists of this property, with this propery only the controls are
identified.

13. Define Variable.


Ans:The variable is the one which can be changed during the execution of the
program. The variable can be declared using the dim statement.

14. What is the use of DIM statement?


Ans: The dim stands for dimension and with the help of this statement the data can be
declared with this statement.

PART B

FIVE MARK QUESTIONS:

1. Discuss the properties and events procedures of Command Buttons.


Ans: The Command button is one of the important control in VB, the
command button is used to do the calculation in the form, it is consists of so many events,
it sia always used to do some action to take place in the VB. The Command button
consists of the default events as Click event.

Properties: caption.Apperance, window state, font,heighr, Width

2
Events: click,doubleclick, setfocus, got focus, lost focus, mouse up, mouse
down

2. Draw a neat sketch of the Toolbox

3.Explain all the datatypes in VB.

Visual basic handles 14 standard types of data.

STRING: The string data type holds characters. Identifying variables of this type is to place
a dollar sign($) at the end of the variable name: AStringVariables$

INTEGER: Integer variable hold relatively small integer values (between -32,768 and
+32767). A variable will only be capable of holding integers is to use the percent sign(%) at
the end of the variable name:

AnIntegerVariable%=3

LONG INTEGER: The long integer variable holds integers between -2,147,483,648 and -
2,147,483,647. The identifier you can use for your variables is the ampersand (&).

ALongIntegerVariables=123456789

3
SINGLE PRECISION: number decimal points have different variable types depending on
how large and how accurate. The least accurate is called single precision. They have a
decimal point.

AStringPrecisionVariables!=12.345

DOUBLE PRECISION: The double-precision data type is used when you need number with
up to 16 places of accuracy they will also allow you more than 300 digits.

ADoublePrecisionVariable#=12.345#

CURRENCY: The currency type can have 4 digits to the right of the decimal place and up to
15 to the left of the decimal point. Arithmetic will be exact within this range. The identifier is
an “at” sign(@)-not the dollar sign.

ACurrencyVariable@=12.345@

DATE: The date data type gives you a convenient way to store both date and time
information for any time between midnight on January 1,100, to midnight on december31,
9999. Any assignment to date variables with two #’s.

Millenium=#January 1, 2000#

Millenium=#January 1, 2000#

Millenium=#1/1/2000#

BYTE: The byte type was added to VB 5; it can hold integers between o and 255.

BOOLEAN: The Boolean type when you need data to be either true or false.

VARIANT: It doesn’t matter whether the information is numeric, date the variant type can
hold it all. VB automatically performs conversions ;of data stored in variants to data of
another type.

Ex: Dim a as variant

PART-C

1.Discuss about Message Box.

Message boxes display information in a dialog box superimposed on the form. They wait for
the user to choose a button before returning to the application. Users cannot switch to another
form in your application as long as visual basic is displaying a message box. Message boxes
should be used for short messages or to give transient feedback.

 The simplest form of the message box:

4
Msgbox “The message goes in quotes”

 Message boxes can hold a maximum of 1024characters, and vb automatically breaks


the lines at the right side of the dialog box.

 We can also add event procedures :

Private sub cmdmybutton_lostfocus ()

Msgbox “you have to click the button for anything to happen”

End sub

SYNTAX

MsgBox messageInbox, TypeOfBox, TitleOfBox

SYMBOLIC CONSTANT VALUE MEANING

VbOkOnly 0 Display OK button only

VbOkCancel 1 Display OK and Cancel buttons

VbAbortRetryIgnore 2 Display Abort, Retry and Ignore buttons

VbYesNoCancel 3 Display yes, No and cancel buttons

VbYesNo 4 Display Yes, No buttons

VbRetryCancel 5 Display Retry and Cancel buttons

VbCritical 16 Display Critical message icon

VbQuestion 32 Display Warning Query icon

VbExclamation 48 Display Warning Message icon

VbInformation 64 Display Information Message icon

EXAMPLE:

Msgbox (“will have yes and no buttons”,vbYesNo)

2.Explain Editing tools.

5
Good programming builds on code that is easy to read. VB you have been able to control the
size, font, and even the color of different pieces of your code. Indenting lines as you will
soon see, makes your code a lot easier to understand.

THE EDITOR FORMAT PAGE: Choose tools options (Alt+t,o) and click on the editor
format tab.

The code colors frame contains a list of the possible objects you can change.

For example: you can change normal text, comment text, and so on. The bottom of this
frame has 3 boxes currently set to auto, which means VB is in control of the color choices.

FONT LIST BOX: Click on the down arrow in the font drop-down list box to see the
complete of fonts. The default font is courier new font.

SIZE LIST BOX: You can type a point size for the font directly in the size list box or choose
a size by clicking on the down arrow and then clicking on the size. This lets you change the
font size.

FORE GROUND, BACK GROUND AND INDICATOR LIST BOXES: The three code
colors boxes determine the fore ground and back ground colors used for indicators in the
margin, such as bookmarks. The default is that comments are green and syntax errors are
highlighted in red.

WE CAN CHANGE THEM BY FOLLOWING STEPS:

1. Click on the code element you want to work within the code colors list box

2. Click on the arrow in the fore ground drop-down list

3. Click on the color you like and choose OK.

SAMPLE BOX: This box lets you see a sample of text in the font, size, and color settings
that are currently set.

3.Explain Editor Tool Bar

Many useful editing features have button equivalents on the edit toolbar.

TOOL FUNCTION KEYBOARDEQUIVALENT DESCRIPTION

List properties/methods Ctrl+j Displays a pop-up list box


with the properties and
methods for the object
preceding the period.

List constants CTRL+SHIFT+J Displays a pop-up list box


6
with the valid constants.

Quick info CTRL+I Gives the syntax for the


procedure or method.

Parameter info CTRL+SHIFT+I Provides the parameter list


for the current function call

Complete word CTRL+SPACEBAR Completes the keyword.

Indent TAB Indents the selected text


one tab stop

Outdent SHIFT+TAB Moves the selected text


back one tab stop.

Toggle break point F9 Used for debugging

Comment block NONE See the following section


“comments” for more
information on comments.

Uncomment block NONE See the following section,


“comments” for more
information on comments

Toggle bookmark NONE The editor allows you to


put bookmark at specific
places in your code

Next bookmark NONE Move to next bookmark

Previous bookmark NONE Move to previous


bookmark

Clear all bookmark NONE

7
UNIT-II

TWO MARK QUESTIONS:

1. Define: Indeterminate Loop.


Ans: The Indeterminate loop is one of the important loops in VB, the
indeterminate loop as the name suggests that the loop is going to be indeterminate ,
the number of times the statement execution is not determinate.

2. What are Functional Procedures?


Ans: The Function is one of the important concept, the function is always called
as the sub procedure or the small part of the program, which can be called any where in
the program, in Vb the function can be defined in the menu called tools and from the tools
menu , the function can be created in VB.

3. What are determinate loops? Give an example.


Ans: The determinate loop is one of the important loop and the determinate loop is the
one which will execute the statements for the specified number of times.
E.g.: for (i=0; i=n; i++)

4. What is while loop?


Ans: The while loop is one of the looping constructs in vb, the while loop will execute the
set of statements until the condition is true.

5. What is the use of do….while loop?


Ans: The do… while loop is also one of the important loop, in this looping construct,
whether the condition is true or false, the statements inside the loop will be executed
at least once.

6. What is picture box?


Ans: The picture box is used to add the pictures in vb, the picture box once drawn and
add the pictures means the size of the picture will remain same.

7.What is HScroll?
Ans: The HScroll is used to add the horizontal scroll bar to the form. It is used to any
other control and it cannot be activated individually and it also contains so many
properties.

8.Define VScroll.
Ans: The VScroll is used to add the vertical scroll bar to the form. It is used to any other
control and it cannot be activated individually and it also contains so many properties.

9. What is the use of Replace function.?


Ans:Allows you to replace one or more occurrences of a string inside another.
Syntax :
Replace (Expression, find, Replace with)

Test String$ = “Java Script is best scripting language”

8
Test String$ = “replace(Teststring$, “Javascript”, “VB script”)

10.Write about DateAdd().


Ans:Returns a date after adding or subtracting a specified time interval to another date.

Example : My date = # 17/7/10.


Print Date Add (“d”, 5, Mydate)
AM – 22/7/10.

Five marks
1. Explain about Rich text Box.
Rich Text Boxes :
The rich text box control is a custom control, you will need to add it to the tool
box if it is not already there, to do.
1. Choose project | components to open the components dialog box.
2. Choose Microsoft Richtext Box Control 6.0
 The Rich Text Box display text with multifonts & sizes.
 This is not limited to 32K character like an Ordinary text box.

Important Properties Of Rich Text Box :

Multilines , Scrollbars...

Property

SelLength - Returns or sets the no. of characters selected.

SelStart - Returns or sets the starting point of the selected text.It will tell you the current
insertion point . if no text is Selected.

SelText -Returns or sets a string equal to the currently selected text gives you a “
“ if no characters are currently selected.

Set Bold ,Set Italic,SelStrikethrough, Sel Underline

 These properties let you control whether font is bold, italic and so on.
Rich Text Box1. Set Bold =Time
 This property sets the color of the currently selected text and of all text added
after the current insertion point. Eg:
Rich Text1 . Set Bold = Time
 This property lets you change the font.
For eg :
Rich Text1.set color = VbRed.
 This property lets you change the font .
For Ex: RichText1.setFontName =”courier”

9
 This property lets you change the size of the currently selected text. The
syntax is
Object. Set Font Size =size
The theoretical maximum value for Set Font Size is 2160 points.
2. Discuss any 5 String functions.
 The StrComp Function :
 Used to compare the strings.
Str Comp(A$ , B$)
Example :
StrComp(Raj, raj)
Return -> 1
 If A is greater than B returns1, -1 if it is less. If both are equal returns 0.
 Length :
 Used to find out the length of a string.
A $ = “Raja”
B = len(A $)
Returns 4.
 L Trim :
 Removes spaces from the beginning a string.
L Trim(string)
A $ = (“Raja”)
B = Raja.
 Asc :
 Returns the character code corresponding to the first letter in a string.
Asc(“Apple”)
Returns 65.
 L case and U case :
 Used to convert into lowercase and uppercase.
Syntax 1:
L case(String)
A $ = Raja
B = L case(A $)
Returns raja.

3. Discuss about Date Function.


1. The Date Function :
 The Date Function returns a date of the form month-day-year,

for the current date.

 The month & day always use two digits and year uses four digits.
Example : 01-01-1999.
Format : Date = ‘mm-dd-yyyy’.
10
mm-> numerals, from 01 to 12.
dd-> numerals, from 01 to 31.
Years->numerals, between 100 to 9999.

Time :

 You can read the time in the system clock.


 The Time Functions returns eight-character date of the form hh:mm:ss

Numeric Calendar Function :


Date value :
VB supplies the function of Date type representing the date defined by the
string expression inside the parentheses.
Example :
Dim a As Date.
a = Date Value (“12-31-1999”)
a = Date Value (“December 31, 1999”)
a = Date Value (“Dec 31, 1999”)
a= Date Value (“31 December 1999”)
a= Date Value (“31-Dec-1999”)

Date Diff ( )

 Returns the different between two dates.


 Date Diff (Variable name, date1, date2)

Example : Datediff (a, 17/7/10, 11/7/10)


Date Add( )

 Returns a date after adding or subtracting a specified time interval to another date.
Example : My date = # 17/7/10.
Print Date Add (“d”, 5, Mydate)
AM – 22/7/10.

Date Part( )

 Returns the specified part of a date variable.


Today = Now.
Print DatePart(“m”, Today) – month.
Print DatePart(“d”, Today) – day.
Print DatePart(“yyyy”, Today)- year.
Now-> Returns the current system time & date.
Date-> Returns the current system date.
Time->Returns the current system time.

11
TEN MARKS:
1. Explain financial Function.
Pmt :
Returns the payment for an annuity based on periodic, constant payments and a
constant interest rate.
Syntax :
Pmt ( Rate per period, Num periods, what you start with, what you end up with,
when do you pay)
(or)
Pmt ( rate, nper, PV [ , FV [ , type]]
Rate -> rate per period, Quoted for per year (i.e) 0.8/12
N per-> no.of.periods
PV-> present value
FV-> Future Value
Type -> payment made whether at the beginning of the period or at the end.

Other Financial Functions

1. FV :- This function gives you the future value of an annuity based on period
payments and a constant interest rate.
FV ( rate, n per, pmt[, pv [, type]])
2. IPmt :- This gives the interest paid over a given period of an annuity based on
periodic, equal payment and a constant interest rate.
Syntax : Ipmt ( rate, per, nper, pv ,fv,due)
Example :- Ipmt (. 08/12, 25, 360, 10000, 0,1)
3. Nper :- This function tells you how long it will take to accumulate an annuity.
Syntax : Nper ( rate, pmt, pv, fv, due).
4. PV :- PV gives you present value.
Syntax : pv ( rate, nper, pmt, fv, due)
Example : pv( .06/12, 120, -1000, 0, 1)
5. NPV :-This gives you net present value function.
Syntax : Npv( Rateperperiod, Arrayof( ))
Arrayof() – will fill the array value.
With the appropriate values in the correct order.
6. The function gives interest rate per period for an annuity.
Syntax : Rate ( nper, pmt, pv, fv, due, guess)
Guess : gives 0 : 1.

2. Write about function and procedures

Function Creation

To create a function, you use the Function keyword followed by a name and parentheses. Unlike a sub routine,
because a function returns a value, you should/must specify the type of value the function will produce. To give
this information, on the right side of the closing parentheses, type the As keyword, followed by a data type. To
12
indicates where a function stops, type End Function. Based on this, the minimum syntax used to create a
function is:
Function FunctionName() As DataType
End Function
The name of a function follows the same rules and suggestions we reviewed for sub routines.
The DataType factor indicates the type of value that the function will return. If the function will produce a word
or a group of words, you can create it as String. If the function will check something and determine whether it
produce a true or a false value, you can create it as Boolean.

1. Display the Routines module and delete (only) the previously implemented routines
2. To create a new function, at the end of the file, type function RectPerimeter and press
Enter
3. To create another function, on the main menu, create Tools -> Add Procedure...
4. In the Name edit box, type RectArea
5. In the Type section, click Function

6. Press Enter

7..Save all
Using subroutines :

 Subroutines execute the code that they contain when they are called.
 Subroutines are called by placing its name into a line of code.
Example :
Public sub head ( )
Print “ welcome “
Print “ To “
Print “ VB world “
End sub.
Private sub command1_click( )
head

13
3. Explain conditional Statement
 The If...Then selection structure performs (selects) an action (or sequence of
actions) based on a condition.
If the condition evaluates to True, the actions specified by the If...Then structure are
executed. If evaluates to False, the actions structure are skipped.

The general format for the if...then... statement is

If conditions Then
VB expressions
End If

 The If...Then...Else selection structure


Performs an action (or sequence of actions) if a condition is true and performs a
different action (or sequence of actions) if the condition is false.

The general format for the if...then...else statement is

If conditions Then
VB expressions
Else
VB expressions
End If

 Nested If... Then...Else Statements

We need to use nested If...Then... Else statements if a condition is depending on other


conditions that have to be fulfilled first. A nested If statements are enclosed within other If
statements. There can be many levels of nested If .. Then ..Else statements but will examine
only the two-level nested statements. The format for a two level nested If ..Then...else
statement is as follows:
If condition A Then
If Condition B Then
VB6 statement
Else
VB6 statement
End If
End If

 The Select Case structure performs one of many actions (or sequences of
actions), depending on the value of an expression.
Syntax:
The format of the Select Case control structure is show below:
14
Select Case expression
Case value1
Block of one or more VB statements
Case value2
Block of one or more VB Statements
Case value3
. .
Case Else
Block of one or more VB Statements
End Select

UNIT-III

TWO MARKS:

1.Distinguish between Fixed and Dynamic Arrays.


Ans: The Fixed and dynamic arrays are the different types of arrays in VB, the
fixed array is the array in which the array has to be defined previously and the size of
the array cannot be changed during the execution of the program.

The Dynamic array is also one of the types of array, in dynamic array, the size
is not predefined and the size of the array can be changed during the execution of the
program. The memory space is really saved in dynamic array.

2.What are Frames?


Ans: The frame is one of the controls in Vb, the frame is used to group the
controls in the form with the common heading, and the frame is used to move the
controls in group, without giving the same name to the controls.

3. What are Combo Boxes?


Ans: The combo boxes is one of the important control in vb, it is used to
display the group of options in a simple one line manner, the size of the control
cannot be changed, even if u can store 10 values at a time, it will display only one at
a time.

4. What is a List box?


Ans: The list box is also one of the controls in tool box, it is used to store more than one
item in a list and it can show all the items at the same time, the size of the list box can be
changed, if u wants to select more than one item from list use ctrl key.

15
5. Define: Record.
Ans: The record is used to show the data that are stored in the data base.

6.What are control Arrays

Ans: The control arrays are one of the important concept in VB, it is nothing but
grouping the controls together. The control arrays can be made by giving the same
name property to all the controls that we want to group.

7.What is menu control array?


Ans: The menu control array is also one of the important topics; the menu control
array is the one, in which the menus are grouped under the single name.

8. What is the use of flex grid?


Ans: The flex grid is one of the important concepts and the flex grid is one of the
components and it can be add through the components window, the flex grid control is
used to display the data in the row and column manner.

FIVE MARKS
1. Dicuss about Arrays in VB
An array is a list of variables with the same data type and name. When we work with a
single item, we only need to use one variable. However, if we have a list of items which
are of similar type to deal with, we need to declare an array of variables instead of using a
variable for each item.

Dimension of an Array
An array can be one dimensional or multidimensional. One dimensional array is like a list
of items or a table that consists of one row of items or one column of items.

A two dimensional array is a table of items that make up of rows and columns.

Declaring Arrays
We can use Public or Dim statement to declare an array just as the way we declare a
single variable. The Public statement declares an array that can be used throughout an
application while the Dim statement declare an array that could be used only in a local
procedure.

To declare a one dimensional array is as follow:


Dim arrayName(subs) as dataType

where subs indicates the last subscript in the array.

Example
Dim CusName(10) as String

The general format to declare a two dimensional array is as follow:

To declare a two dimensional array is as follow:


Dim ArrayName(Sub1,Sub2) as dataType
16
Example
Dim StudentName(10,10)
will declare a 10x10 table make up of 100 students' Names, starting with
StudentName(1,1) and end with StudentName(10,10).

Example for array:


Dim studentName(10) As String
Dim num As Integer
Private Sub addName( )
For num = 1 To 10
studentName(num) = InputBox("Enter the student name")
List1.AddItem studentName(num)
Next
End Sub
Private Sub Start_Click()
addName
End Sub

2. Describe about combo and list box

ListBox and ComboBox controls present a set of choices that are displayed vertically in a
column. If the number of items exceed the value that be displayed, scroll bars will
automatically appear on the control. These scroll bars can be scrolled up and down or left
to right through the list.

Property/Method Description
Properties
By setting this property to True or False user can decide whether user can
Enabled
interact with this control or not
Index Specifies the Control array index
String array. Contains the strings displayed in the drop-down list. Starting
List
array index is 0.
ListCount Integer. Contains the number of drop-down list items
Integer. Contains the index of the selected ComboBox item. If an item is
ListIndex
not selected, ListIndex is -1
Locked Boolean. Specifies whether user can type or not in the ComboBox
Integer. Specifies the shape of the mouse pointer when over the area of
MousePointer
the ComboBox
Integer. Index of the last item added to the ComboBox. If the ComboBox
NewIndex
does not contain any items , NewIndex is -1
Sorted Boolean. Specifies whether the ComboBox's items are sorted or not.
Style Integer. Specifies the style of the ComboBox's appearance
17
TabStop Boolean. Specifies whether ComboBox receives the focus or not.
Text String. Specifies the selected item in the ComboBox
ToolTipIndex String. Specifies what text is displayed as the ComboBox's tool tip
Visible Boolean. Specifies whether ComboBox is visible or not at run time
Methods
AddItem Add an item to the ComboBox
Clear Removes all items from the ComboBox
RemoveItem Removes the specified item from the ComboBox
SetFocus Transfers focus to the ComboBox
Event Procedures
Change Called when text in ComboBox is changed
DropDown Called when the ComboBox drop-down list is displayed
GotFocus Called when ComboBox receives the focus
LostFocus Called when ComboBox loses it focus

Adding items to a List

It is possible to populate the list at design time or run time

Design Time : To add items to a list at design time, click on List property in the property box
and then add the items. Press CTRL+ENTER after adding each item as shown below.

Run Time : The AddItem method is used to add items to a list at run time. The AddItem
method uses the following syntax.

Object.AddItemitem, Index

The item argument is a string that represents the text to add to the list

The index argument is an integer that indicates where in the list to add the new item. Not
giving the index is not a problem, because by default the index is assigned.

Following is an example to add item to a combo box. The code is typed in the Form_Load
event

Private Sub Form_Load()

18
Combo1.AddItem 1
Combo1.AddItem 2
Combo1.AddItem 3
Combo1.AddItem 4
Combo1.AddItem 5
Combo1.AddItem 6

End Sub

Removing Items from a List

The RemoveItem method is used to remove an item from a list. The syntax for this is given
below.

Object.RemoveItem index

TEN MARKS

1.Discuss about MDI Forms in VB.


 MDI stands for Multi Document Interface , which is Microsoft’s term for a
windowing environment is which one window , usually called the MDI container or
MDI parent form.

 The MDI parent which contains many other windows , usually called child forms.

EXAMPLE:

You can use a MDI parent form to allow a user to work with two separate windows in the
same application

You can have only one MDI parent form to a project and that form must be a startup form.

TO WORK WITH MDI FORMS:

 Go to file->New MDI form

 Then next create the additional forms as usual.

 These will be the child forms to your newly created MDI form , after you set the
form’s MDI child property to true.

 Even , you can add the existing form into an MDI child form.

 At the design time, child form and MDI form look alike.

 When you run the project, the child form must be explicitly shown(by show method)
and they are displayed within the MDI parent form’s boundries.

19
 Then, if the child forms is minimized, its icon appears inside the MDI parent form
rather than in the windows desktop.

 You can neither hide nor disable child forms.

 The other feature of VB that, MDI forms is that the menus of the parent form change
according to which child form has the focus.

THE WINDOW MENU AND THE ARRANGE METHOD:

 Every MDI application should have a window menu that allows the user to arrange or
cascade the child windows.

 The window menu should also include a list of the MDI child windows.

EXAMPLE:

 The list of MDI child windows can also put in menus. Set windowlist check box on
the menu editor window to be on.

TO ACTIVATE THE TITTLE, CASCADE AND ARRANGE:

Sub mnucascadeform_click()

MDIparentform.arrange Vbcascade

End sub

 These uses the Vbcascade costant with the arrange method. The other two costants are
VbTileHorizontal and VbArrangeIcon.

20
2. Explain Shell Sort in VB
Shell sort developed by Donald L. Shell is a non-stable in-place sort. Shell sort
improves on the efficiency of insertion sort by quickly shifting values to their
destination. Average sort time is O(n7/6) while worst-case time is O(n4/3).

Public Sub ShellSort()


Dim NumofEntries%, inc%, j%, Temp
NumofEntries = UBound(A$)
Inc% = NumofEntries% \2
Do Until inc% 1
For I% = inc% + 1 To NumofEntries%
Temp$ = A$(I%)
For j% = I% - Inc% to 1 step –inc
If temp$ >= A$(j%) Then Exit For
A$(J% + inc%) = A$(j%)
Next J%
A$ (J%+inc% ) = temp$
Next I%
Inc%= inc%\2
Loop
End Sub

3. Write program for Bubble sort.


BubbleSort

Public Sub BubbleSort(ByRef iaArray() As Integer)


Dim n As Integer, i As Integer, j As Integer
n = UBound(iaArray)
For i = (n - 1) To 0 Step -1
For j = 0 To i
If iaArray(j) > iaArray(j + 1) Then
Swap iaArray(j), iaArray(j + 1)
End If
Next j
Next i
End Sub

Private Sub Swap(ByRef xArg1, ByRef xArg2)


Dim xTmp
xTmp = xArg2
xArg2 = xArg1
xArg1 = xTmp
End Sub

UNIT-IV
TWO MARKS

1..Write a note on: MDI.


21
Ans: MDI stands for multiple document interfaces; it is used to combine more than one
document together.

2. What is the use of menu editor?


Ans: The menu editor is used to add the user defined menus in VB, the menus
plays a very important role in vb and it makes really a very important design in vb.

3.Define Slide window control.


Ans: The slide window control is one of the important controls in vb and it is used to
activate the particular form as a slide.

4.Define progress bar.


Ans: The progress bar control is one of the important controls and the progress bar will be
added to the form and it can be used to display the progressing st
Satus of the window.

5.What is tree view control?


Ans: The tree view control is one of the common controls available in vb, the tree view
control is used to display the projects that are opened in the form.

6.Explain how to use error handling routines to generate errors.


Ans: the error handling functions like Do Event can be used to handle the errors in vb
so that the errors can be easily rectified in vb.

7. .Define design time debug.


Ans: The design time debug id the very big advantage of vb, the designing
time itself if there is any error , it will be identified and highlighted by the vb
window.

8. What is RGB?
Ans: The RGB stands for Red, Green, and Blue. The change of the color can be done
with the help of the RGB through coding.

9. What is QB Color?

Ans: The QB stands for Quick Basic color. The change of the color can be
done with the help of the RGB through coding.

10. How to add graphics in vb.


Ans: The graphics can be added to the vb window by using the shapes and image
control in vb.

11. What is the use of shape controls?


Ans: The Shape controls can be used to add the shapes in the vb window, the shapes
like circle, rectangle, and square and so on through the coding.

22
12. Explain how to use error handling routines to generate errors.Ans: the error handling
functions like Do Event can be used to handle the errors in vb so that the errors can be
easily rectified in vb.

13. Define design time debug.


Ans: The design time debug id the very big advantage of vb, the designing
time itself if there is any error , it will be identified and highlighted by the vb
window.

FIVE MARKS

1. Discuss vb object Browser.


To display the Object Browser
 Open the Visual Basic Editor, and then click Object Browser on the View menu.

The Object Browser

The Project/Library box shows all the available referenced type libraries. These libraries
make it possible for you to use early binding with the corresponding applications.
The Search Text box shows any keywords you have searched for by using the drop-down
list. You can also type a word in this box, and then click the Search button to search the
available libraries for that word. The Search Results list displays any classes, properties,
methods, events, or constants that contain the word you searched for.

The Classes list displays all objects and collections in the library, and the Members of list
displays all methods, properties, events, and constants associated with the selected object in
23
the Classes list. The bottom pane of the dialog box (the Details pane) displays other
information about the currently selected item, such as what kind of object it is, its data type,
what arguments it might take, and what library or collection of which the item is a member.

If a Help file has been associated with the objects in the type library, you can display a Help
topic by clicking the item in either the Classes or Members of list, and then pressing F1 or
clicking the Help button in the upper-right corner of the dialog box.

2.Explain common dialog boxes


The CommonDialog control provides a standard set of dialog boxes for operations
such as opening and saving files, setting print options, and selecting colors and
fonts. The control also has the ability to display help by running the Windows Help
engine.

Syntax:

CommonDialog

The CommonDialog control provides an interface between Visual Basic and the
routines in the Microsoft Windows dynamic-link library Commdlg.dll

The CommonDialog control can display the following dialogs using the specified
method.

Method Dialog Displayed

ShowOpen Show Open Dialog Box

ShowSave Show Save As Dialog Box

ShowColor Show Color Dialog Box

ShowFont Show Font Dialog Box

ShowPrinter Show Print or Print Options Dialog Box

ShowHelp Invokes the Windows Help Engine

3. Write short notes on: the Debug Toolbar.


Ans: Types

24
EXAMPLE
4.Explain the properties of multiple forms.
Ans: Definition
Properties
Examples

TEN MARKS

1. Explain about Menu Editor Window.


You can use the Menu Editor to create new menus and menu bars, add new
commands to existing menus, replace existing menu commands with your own commands,
and change and delete existing menus and menu bars.
To display the Menu Editor

1.From the Tools menu, choose Menu Editor.


2. ctrl+E

3. Click the Menu Editor button on the toolbar.

This opens the Menu Editor,

While most menu control properties can be set using the Menu Editor, all menu properties are
available in the Properties window. The two most important properties for menu controls are:

 Name — This is the name you use to reference the menu control from code.

 Caption — This is the text that appears on the control.

OK and CANCEL BUTTONS:


OKFinish the designing the menu

25
CancelDecide not to build the menu at all.

INDEX BOX:
Creates index number
It makes a menu item part of a control array.

SHORTCUT:
This box add accelerator key to your menu items.
Ctrl + key combination that activate a menu item.

WINDOW LIST:
It is used when you have MDI windows.

HELPCONTEXTID:
This is used when you are adding a help system.

CHECKED CHECKBOX:
Determine whether a check mark shows up in front of the menu item.
The default is off.

ENABLED CHECKBOX:
Determine the values of the enabled property of the menu item
It will respond to the click event.

VISIBLE CHECKBOX:
Determine the values of the visible property of the menu item. If a property of the menu item
is made invisible, all its submenus are also invisible.

ARROW BUTTON:

To control the level and position of the menu item being entered, just use the four direction
arrows in the Menu Editor. The up and down arrows reposition menu items for order. The left
and right arrows allow menu items to be top-level, sub-level or sub–sub-level.

You can implement a separator bar in a menu (a horizontal line that visually defines the
boundary between two groups of menu items) by putting a single dash (-) as the entire
caption for a menu item. This item then becomes the separator bar on the runtime menu. You
must remember that even separator items in a menu must each have their own unique Name
property.

Menu items can also have their appearance properties set at design time through the Menu
Editor. Properties such as Checked, Enabled, Visible, WindowList, and a shortcut key can all
be specified.

NEXT BUTTONS:
Clicking the next buttons moves you to the next menu item or inserts a new item.
Alt+N is a access key.
26
INSERT BUTTONS:
Clicking the insert button insert a menu item
Alt+I is a access key.

DELETE BUTTON:
Clicking the delete button removes the currently highlighted item.
Alt+T is a access key.

2. Explain Debugging and optimization.


 Testing
 Bugs
 Immeditate window
 The debug objects
 The debugging tools
 Single stepping
 Stopping program temporarily
 Local window
 Variable watch and quick watch
 Watch item
 To remove the watch window
Testing:
 Once the user finish writing a program, you will need to test it for bugs.
 Testing programs is the first steos in the debugging process

Bugs:
 While compiling we can get 2 types of bugs
 Grammatical-misspelled variable name
 Logical-misunderstanding how the program works
Example:
 Procedures that don’t communicate properly and internal logic errors inside the code.
The immediate window:
 VB uses the immediate window with the result of simple calculation
 You can use the immediate window to test statements or to oerform quick calculation,
when you are in break mode.
 Type print 2+2 in the immediate window and press enter or ? 2+2
 The debug Objects:
You use a predefined VB objects called debug in the following form
Debug.print name of variable
Debug.print Expression
VB encounters a debug.print statements, it sends the requested information to the immediate
window. It does not stop the program.
Debug.print”The vakues of X is”;

27
THE DEBUGGING TOOLS:
Choose viewToolbarsdebug
The debugging tools are used when the program
Is temporarily suspended
 Single stepping:

STOPPING PROGRAM TEMPORARILY:


 Ctrl+Breakto stop your program
 Click 
 Use toggle BreakPOint ie press F9
 To clear all break point from a program,press Alt+D,C(when you run a program,VB
encounters a break point, VB stops the code just before executing the statements with
breakpoint
 RunClear all breakpoint(It then enters the break mode, you can have multiple
breakmode.)

QUICK WATCH AND VARIABLE WATCH


Variable watch:
 The variable watch features gives the current state of a variables when you are in
break mode by simply holding the mouse over the variable.
 VB’s variable watch and quick watch provides more efficient.
Quick watch:
 Shift+F9 or debug quick watch item
 Quick watch is used to look the value of any variable or expression

28
To use quick watch
 Select the variable or expression you want to watch by moving the cursor to the otem
or highlighting the expression using Shift+arrow key combination.
 Debug menuquickwatch.
 Use quick watch button.
WATCH ITEMS
 Watch item are variable, expression or condition that are displayed in a special
window called watches window.
 Debugwatch

To remove watch window:


 Highlight the whole line in the watch window and press delete
 Choose debugedit
 This opens a dialogbox that look similar to watch dialog.

29
3. Discuss about Common controls
o Image Control
o ListView Control
o Progressbar Control
o Slider Control
o Statusbar Control
o Tabstrip Control
o Toolbar Control

IMAGELIST CONTROLS:

FIGURE 4.2 The General tab of the Property Pages dialog box for the ImageList control.

The list of images contained in the ImageList control can be managed through the Images tab
of the Property Pages dialog box, as shown in Figure 4.3. This tab enables you to add and
remove images from the control as well as set additional information about each image. The
Index of each image is assigned by Visual Basic. The Index starts at 1 for the first image and
increments by 1 for each additional image.

LIST VIEW CONTROLS:

This control is used to arrange items into columns.


The item can be accomplished by both icon & text.
The value of view property, describes as

CONSTANTS VALUE DESCRIPTION

LvwIcon 0(Default) Each listitems object is


represented by a full-sized
Icon & Label.
Each listitems object is
LvwSmallIcon 1 represented by a Small-sized
30
Icon & Label that appears to
the right of the icon/The
items are arranged
horizontally.

LvwList 2 The item are arranged


vertically.

lvwReport 3 The item are arranged


vertically/The icons & labels
appear in column.

PROGRESS BAR CONTROL:

The progress bar is similar to using a vertical bar in gauge control.


It filts in a bar with rectangular chunks.
Using the align property to position the control.

SETTING DESCRIPTION

0(VbAllignNone) (Default) size & location are arbitrary.

1(VballignTop) Bar is at the top of the form & it is wide as


the form.

2(VbAllignBottom) Bar is at the bottom of the form & it is wide


as the form.

3(VbAllignLeft) Bar is at left-alligned at the edge of the form.

4(VbAllignRight) Bar is might aligned top at the edge of the


form.

SLIDER CONTROL:

The slider control works similarly to scroll bar. It is a little box with optional tick marks that
contains a slider.

The user can move the slider by dragging it, clicking the mouse to either side of the slide or
using the keyboard.

PROPERTIES:

Max-Determines largest values


Min-Determines smallest values

31
Value-Determine current events

KEY EVENT:

It is a scroll event, ie which is triggered when the users moves the slider on a slider control,
by clicking on the control or using keyboard.

StatusBar control:

The StatusBar control is another ActiveX Control available through the Windows Common
Controls components. With the StatusBar, you can easily display information about the date,
time, and other details about the application and the environment to the user.
TAB STRIP CONTROL:
A tap strip controls provides a form, that look like a tabbed dialog box.
TOOL BAR CONTROL:
Tool Bar control is used to build toolbars into the projects
Toolbars appears on the top, 80 the align property defaults to 1(top)

SYNTAX:
Set ButtonObject=NameOfToolbar.Buttons Add([Index],[Key],[caption],[style],[image])
All are optional
TREE VIEW CONTROL:
It is similar to window explorer
The treeview control has a nodes collection that holds information about the nodes in the
control.
The highest node is given by root property.

UNIT-V

TWO Marks

32
1. Explain the advantages of DLL.
Ans: The DLL stands for dynamic linking libraries, which is used to
dynamically link the related library contents to the vb form.

2. Define file list box.


Ans: The file list box is one of the important list boxes available in vb and it is used to
display the files in the directory available.

3.Define Drive list box.


Ans: The Drive list box is one of the important list boxes and it is used to display the
drives in the system.

4. Write about COM


Ans: COM stands for component object model. The com can be used to add the
different types of objects for the vb.

5. What is the use of click event?


Ans: The click event is the default event of the command and it is activated when the
button is clicked..

6. Define key press.


Ans: The key press is the default event of the keys and it is activated when the key is
pressed in the key board.

7. Define key down.


Ans: When the key is down, this event is activated and this is used to do some action
when the key is pressed down.

8. Define mouse down.


Ans: The mouse down is also one of the events in vb and it will be activated when the
mouse button is pressed down.

9. Define mouse up.


Ans: The mouse up is one of the event in vb and it will be activated when the mouse
is released.

10. What is the use of Got focus?


Ans: The Got focus is the event in vb and this event is fired out when the cursor is
inside the particular control.

11.What is the use of lost focus?


Ans: The Lost focus is the event in vb and this event is fired out when the cursor is come
out of the particular control.

12.Define visible.
Ans: The Visible is one of the important property in vb and it makes the
control visible or not.

13.Define enable.
33
Ans: The Enable is also one of the important property and it is that the control
will be visible but it cannot be activated.

14. What is the difference between visible and enable.


Ans: The difference between the visible and enable is the control will
be out of focus once the visible is made false, but in enable is false , the
control is visible but cannot be activated.

15. What is a API?

The 'Application Programming Interface', or API in short, is a very important part of


operating software, like Microsoft Windows for instance. Those functions give the
programmer access to the core functions, facilities and features of the operating
system.

FIVE MARKS

1. Explain File Handling Functions


 The Line Input # statement Reads a single line from an open sequential file and
assigns it to a String variable.

Line Input #filenumber, varname


filenumber Required. Any valid file number.

varname Required. Valid Variant or String variable name.

 The Input # statement Reads data from an open sequential file and assigns the data to
variables.
Input #filenumber, varlist
filenumber Required. Any valid file number.
varlist Required. Comma-delimited list of variables that are assigned values read from the

 Print # Statement Writes display-formatted data to a sequential file.

Print # Statement Writes display-formatted data to a sequential file.


Print #filenumber, [outputlist]

filenumber Required. Any valid file number.


The outputlist argument settings are: [{Spc(n) | Tab[(n)]}] [expression] [charpos]

 Write # Statement - Writes data to a sequential file.

Write #filenumber, [outputlist]

filenumber Required. Any valid file number.


outputlist Optional. One or more comma-delimited numeric expressions or string
expressions to write to a file.

34
 Open Statement - Enables input/output (I/O) to a file.
Open pathname For mode [Access access] [lock] As [#]filenumber [Len=reclength]

 Input Function - Returns String containing characters from a file opened in Input or
Binary mode.
Input(number, [#]filenumber)

 FreeFile Function - Returns an Integer representing the next available for use by the
Open statement.
FreeFile[(rangenumber)]

 Close Statement - Concludes input/output (I/O) to a file opened using the Open
statement.
Close [filenumberlist]

 Put Statement - Writes data from a variable to a disk file.


Put [#]filenumber, [recnumber], varname
 Get Statement - Reads data from an open disk file into a variable.
Get [#]filenumber, [recnumber], varname
The Get statement syntax has these parts:

 Seek Function - Returns a Long specifying the current read/write position within a
file opened
Seek(filenumber)
Seek returns a value between 1 and 2,147,483,647 (equivalent to 2^31 – 1), inclusive.

 EOF Function : Returns an Integer containing the Boolean value True when the end
of a file has been reached.
EOF(filenumber) - The required filenumber argument is an Integer containing any valid file
number.
Use EOF to avoid the error generated by attempting to get input past the end of a file.
 LOF Function : returen size in bytes, of a file opened using the Open statement.
LOF(filenumber)
The required filenumber argument is an Integer containing a valid file number.
Note Use the FileLen
 FileLen Function - function to obtain the length of a file that is not open.
FileLen(pathname) pathname specifies a file, may include the directory or folder, and the
drive.
 GetAttr Function - Returns an Integer representing the attributes of a file, directory,
or folder.
GetAttr(pathname) -value returned by GetAttr is the sum of the following attribute values:

2. Explain DLL Server


A Dynamic Link Library (DDL) is a file that contains compiled code.
it's like an executable program (i.e., an EXE file), but there is one major difference:
Once a DLL is installed and registered on a system, its code is available to any program that
calls it.

35
This can be an advantage when you're writing multiple programs that will usually be
installed together
By placing shared code in a DLL, you can decrease program size and simplify the task of
upgrades, and also make the code easily reusable in other projects.

3. Discuss OLE Automation


In Microsoft Windows applications programming, OLE Automation (later renamed by
Microsoft to just Automation, although the old term remained in widespread use), is an inter-
process communication mechanism based on Component Object Model (COM) that is
intended for use by Scripting Languages -originally Visual Basic, but now many languages
that run on Windows.
It provides an infrastructure whereby applications called automation controllers can
access and manipulate (i.e. set properties of or call methods on) shared automation objects
that are exported by other applications.
It supersedes Dynamic Data Exchange (DDE), an older mechanism for applications
to control one another. As with DDE, in OLE Automation the automation controller is the
"client" and the application exporting the automation objects is the "server

TEN Marks:

1.Discuss about Directory List Boxes and Drive List boxes.

Three of the controls on the ToolBox let you access the computer's file system. They are
DriveListBox, DirListBox and FileListBox controls (see below figure) , which are the
basic blocks for building dialog boxes that display the host computer's file system

 DriveListBox : Displays the names of the drives within and 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.

 DirListBox : Displays the folders of current Drive. The basic property of


this control is the Path property, which is the name of the folder whose sub
folders are displayed in the control.

 FileListBox : 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. Ten Marks

Path property to point to the root directory of the selected drive:


Private Sub Drive1_Change()
' The Drive property also returns the volume label, so trim it.
Dir1.Path = Left$(Drive1.Drive, 1) & ":\"
36
End Sub
When the user double-clicks on a directory name, the DirListBox control raises a
Change event; you trap this event to set the FileListBox's Path property
accordingly:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Finally, when the user clicks on a file in the FileListBox control, a Click event is
fired (as if it were a regular ListBox control), and you can query its Filename
property to learn which file has been selected. Note how you build the complete
path:

Filename = File1.Path
If Right$(Filename, 1) <> "\" Then Filename = Filename & "\"
Filename = Filename & File1.Filename

2.Discuss in detail, the file system objects in VB.


The File System Object (FSO) object model provides an object-based tool for
working with folders and files. Using "object.method" syntax, it exposes a
comprehensive set of properties and methods to perform file system operations
such as creating, moving, deleting, and providing information about folders and
files. The FSO also provides methods for reading and writing sequential text files,
however it does NOT have methods for processing binary or random files.

To use the FSO with your VB project, you must add a reference to "Microsoft Scripting
Runtime" (which is the system file "SCRRUN.DLL"). To do this, from the VB IDE, first go
to the Project menu, and select References, as shown below:

From the References dialog box, check Microsoft Scripting Runtime, as shown below, and
click OK.

Once you have done the above, you can use the FSO in your VB project. In your code, you
must declare an object variable for the FSO and instantiate it. The most concise way of doing
this is use the "New" keyword in your declaration, as shown below. (Note: The "Scripting."
qualifier is optional here.)

Dim objFSO As New Scripting.FileSystemObject

An alternative way of doing this is to declare the FSO variable without the "New" keyword
and instantiate it later with the "Set" statement, as shown below. (Note: Again, the
"Scripting." qualifier is optional.)

Dim objFSO As Scripting.FileSystemObject


...
Set objFSO = New Scripting.FileSystemObject

You can also use "late binding" by declaring the FSO variable as a generic "object" and then
using the "CreateObject" method to instantiate it later, as shown below. This is the slowest
37
method, but it is the way it must be done in VBScript. The "Scripting." qualifier is required
here.

Dim objFSO As Object


...
Set objFSO = CreateObject("Scripting.FileSystemObject")

The tables below show the various objects, properties, and methods available with the FSO.

FSO Objects

Object Description
FileSystemObject The FSO itself, highest level of the FSO object model. Allows the
programmer to interact withFiles, Folders and Drives. The
programmer can use the FSO objects to create directories, move
files, determine whether or not a Drive exists, etc.
Drive The Drive object is used to examine information on disk, CD-
ROM, RAM disk, and network drives; the Drives collection
provides a list of physical and logical drives on the system.
File object The File object is used to examine and manipulate files;
the Files collection provides a list of files in a folder.
Folder object The Folder object is used to examine and manipulate folders;
the Folders collection provides a list of subfolders in a folder.
TextStream object Used to read and write text files.

Property of the FileSystemObject

Property Description
Drives Returns a Drives collection, which is a list of physical and logical
drives on the system.

Methods of the FileSystemObject

Method Description
BuildPath Appends file path information to an existing file path.
CopyFile Copies files from one location to another.
CopyFolder Copies folders and their contents from one location to another.
CreateFolder Creates a folder.
CreateTextFile Creates a text file and returns a TextStream object.
DeleteFile Deletes a file.
DeleteFolder Deletes a folder and all of its contents.
DriveExists Determines if a drive exists.
FileExists Determines if a file exists.
FolderExists Determines if a folder exists.
GetAbsolutePathName Returns the full path to a file or folder.
GetBaseName Returns the base name of a file or folder.
GetDrive Returns a drive object.
38
GetDriveName Returns a drive name.
GetExtensionName Returns a file extension from a path.
GetFile Returns a file object.
GetFileName Returns a filename from a path.
GetFolder Returns a folder object.
GetParentFolderName Returns the parent folder name from a path.
GetSpecialFolder Returns an object pointer to a special folder.
GetTempName Returns a temporary (randomly generated) file or folder name
that can be used with CreateTextFile.
MoveFile Moves files from one location to another.
MoveFolder Moves folders and their contents from one location to another.
OpenTextFile Opens an existing text file and returns a TextStream object.

Properties of the Drive Object

Property Description
AvailableSpace The amount of available Drive space in bytes.
DriveLetter A string containing the letter of the Drive without a colon (e.g.,
"C").
DriveType An integer value indicating the Drive type. Possible values are 0
(Unknown), 1 (Removable), 2 (Fixed), 3 (Remote), 4 (CD-ROM)
and 5 (RAM Disk).
FileSystem A string indicating the file system Drive description ("FAT",
"FAT32", "NTFS", etc.).
FreeSpace Same as AvailableSpace .
IsReady A Boolean indicating whether or not a Drive is ready for use.
Path A string containing the Drive's path (e.g., "C:\")
RootFolder A Folder object containing the root folder of Drive.
SerialNumber A long value containing the Drive serial number.
ShareName With network drives, returns a string containing the network share
name.
TotalSize The total Drive size in bytes.
VolumeName A string value containing the Drive volume name.

Properties of the Folder Object

Property Description
Attributes An integer value indicating Folder's attributes. Possible values are
0 (Normal), 1 (ReadOnly), 3 (Hidden), 4 (System), 8 (Volume),
16 (Directory), 32 (Archive), 64 (Alias), and 128 (Compressed).
DateCreated The date the folder was created.
DateLastAccessed The date the folder was last accessed.
DateLastModified The date the folder was last modified.
Drive The Drive where the folder is located.
IsRootFolder A Boolean indicating whether or not a Folder is the root folder.

39
Name A string containing the Folder's name.
ParentFolder A string containing the Folder's parent folder name.
Path A string containing the Folder's path.
ShortName A string containing the Folder's name expressed as an MS-DOS
compliant ("8.3") short name.
ShortPath A string containing the Folder's path expressed as a short (MS-
DOS compliant) path.
Size The total size in bytes of all subfolders and files.
Type A string containing the Folder type (e.g., "File Folder").

Methods of the Folder Object

Method Description
Delete Deletes the Folder. Same as DeleteFolder of FileSystemObject.
Move Moves the Folder. Same as MoveFolder of FileSystemObject.
Copy Copies the Folder. Same as CopyFolder of FileSystemObject.

Properties of the File Object

Property Description
Attributes An integer value indicating File's attributes. Possible values are 0
(Normal), 1 (ReadOnly), 3 (Hidden), 4 (System), 8 (Volume), 16
(Directory), 32 (Archive), 64 (Alias), and 128 (Compressed).
DateCreated The date the file was created.
DateLastAccessed The date the file was last accessed.
DateLastModified The date the file was last modified.
Drive The Drive where the file is located.
Name A string containing the File's name.
ParentFolder The Folder object of the file's parent folder.
Path A string containing the File's path.
ShortName A string containing the File's name expressed as a short (MS-DOS
compliant "8.3") name.
ShortPath A string containing the File's path expressed as a short (MS-DOS
compliant) path.
Size The total size in bytes of the file.
Type A string containing the File type (e.g., "Microsoft Word
Document").

Methods of the File Object

Method Description
Delete Deletes the File. Same as DeleteFile of FileSystemObject.
Move Moves the File. Same as MoveFile of FileSystemObject.
Copy Copies the File. Same as CopyFile of FileSystemObject.
CreateTextFile Returns a TextStream object that can be used to work with the
newly created file.
OpenAsTextStream Opens an existing text file and returns a TextStream object.
40
41

You might also like