![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
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!
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 ControlsMost 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.
|
![]() |
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. |