VB MLM
VB MLM
UNIT-I
PART A
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.
PART B
2
Events: click,doubleclick, setfocus, got focus, lost focus, mouse up, mouse
down
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.
PART-C
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.
4
Msgbox “The message goes in quotes”
End sub
SYNTAX
EXAMPLE:
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.
1. Click on the code element you want to work within the code colors list box
SAMPLE BOX: This box lets you see a sample of text in the font, size, and color settings
that are currently set.
Many useful editing features have button equivalents on the edit toolbar.
7
UNIT-II
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.
8
Test String$ = “replace(Teststring$, “Javascript”, “VB script”)
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.
Multilines , Scrollbars...
Property
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.
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.
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 :
Date Diff ( )
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( )
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.
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.
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.
If conditions Then
VB expressions
End If
If conditions Then
VB expressions
Else
VB expressions
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:
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.
15
5. Define: Record.
Ans: The record is used to show the data that are stored in the data base.
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.
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.
Example
Dim CusName(10) as String
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
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
18
Combo1.AddItem 1
Combo1.AddItem 2
Combo1.AddItem 3
Combo1.AddItem 4
Combo1.AddItem 5
Combo1.AddItem 6
End Sub
The RemoveItem method is used to remove an item from a list. The syntax for this is given
below.
Object.RemoveItem index
TEN MARKS
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.
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.
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.
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.
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).
UNIT-IV
TWO MARKS
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.
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.
FIVE MARKS
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.
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.
24
EXAMPLE
4.Explain the properties of multiple forms.
Ans: Definition
Properties
Examples
TEN MARKS
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.
25
CancelDecide 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.
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 viewToolbarsdebug
The debugging tools are used when the program
Is temporarily suspended
Single stepping:
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 menuquickwatch.
Use quick watch button.
WATCH ITEMS
Watch item are variable, expression or condition that are displayed in a special
window called watches window.
Debugwatch
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.
SETTING DESCRIPTION
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:
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.
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.
FIVE MARKS
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
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]
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:
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.
TEN Marks:
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.
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
Filename = File1.Path
If Right$(Filename, 1) <> "\" Then Filename = Filename & "\"
Filename = Filename & File1.Filename
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.)
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.)
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.
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 Description
Drives Returns a Drives collection, which is a list of physical and logical
drives on the system.
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.
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.
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").
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.
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").
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