Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!:File Management
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!
(Publisher: The Coriolis Group)
Author(s): Peter G. Aitken
ISBN: 1576102815
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Table 14.4 The File objects methods.
Method
Description
Copy dest [, overwrite]
Copies the file to dest. An existing file is overwritten only if overwrite is True (the default).
Move dest
Moves the file to dest.
Delete [force]
Deletes the files. Read-only files are deleted only if force is True. The default is False.
OpenAsTextStream
Opens the file and returns a TextStream object. See Chapter 13 for details.
Table 14.5 The File objects properties.
Property
Description
Attributes
Returns a value summarizing the files attributes, as explained in detail later.
DateCreated
Date and time the file was created.
DateLastAccessed
Date and time the file was last accessed.
DateLastModified
Date and time the file was last modified.
Drive
Drive letter of the drive where the file resides.
Name
Sets or returns the name of the file.
ParentFolder
Returns a Folder object representing the files parent folder.
Path
The path of the file, including drive letter.
ShortName
The short file name used by programs that require the old 8.3 style naming convention.
ShortPath
The short path used by programs that require the old 8.3 style naming convention.
Size
The size, in bytes, of the file.
Type
Returns information about the type of the file (explained in more detail later).
Table 14.6 Values of the Attribute property.
Attribute
Value
Description
Normal
0
Normal file. No attributes are set.
ReadOnly
1
Read-only file. Read/write.
Hidden
2
Hidden file. Read/write.
System
4
System file. Read/write.
Volume
8
Disk drive volume label. Read-only.
Directory
16
Folder or directory. Read-only.
Archive
32
File has changed since last backup. Read/write.
Alias
64
Link or shortcut. Read-only.
Compressed
128
Compressed file. Read-only.
You use Visual Basics logical operators to convert between individual file attributes and the value of the Attributes property. Use And to determine if a specific attribute is set. If f is a File object, then we can write the following code to determine if the files Archive attribute is set:
If f.Attributes And 32 Then
Archive attribute is set.
Else
Archive attribute is not set.
End If
Likewise, the following code checks to see if the files ReadOnly attribute is set and, if it is, clears it:
If f.Attributes And 1 Then
f.Attributes = f.Attributes - 1
End If
To perform the reversesetting the ReadOnly attribute if it is not already setwe would write the following:
If Not f.Attributes And 1 Then
f.Attributes = f.Attributes + 1
End If
The File-Related Controls
Most of what you will do with files in Visual Basic will use the Basic statements, functions, and objects presented so far. Other types of file accesssuch as loading a picture into a Picture Box controlare handled more or less automatically by the associated control. Three Visual Basic controls, however, have been designed specifically to work with files: FileListBox, DirListBox, and DriveListBox. These controls are the topic of this section.
The file-related controls are designed to help you navigate your systems disk drives. Think of how things are arranged on the disk. Each disk, or drive, is identified by a letter followed by a colon. On each drive are one or more folders, or subdirectories, arranged in a hierarchical structure. In each folder are one or more files, each with its own name. A folder can also contain other folders, or it can be empty. Thus, locating any file is a three-tiered process: drive, folder, file name. One control is designed to deal with each of these three levels.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.
Wyszukiwarka
Podobne podstrony:
14 05pętle 2 wym zad 1 14 05 13WSM 14 05 plPetle 2 wymiarowe 14 05 2013pętle 2 wym zad 3 zmienione na ujemne 14 05 1314 05 Kontenery budowlanepętle 2 wym zad 2 14 05 13Wyklad 14 05więcej podobnych podstron