File system controls, Visual Basic Programming

FILE SYSTEM CONTROLS

There are 3 file system controls as shown in figure. The drive list box, directory list box & the file list box. The drive list box control is used to exhibit the disk drives on the system like A drive, C drive, D drive etc. The down arrow in the control helps you to visualize all the accessible drives in the system. The directory list box is used to exhibit the directories accessible in the selected drive. The file list box exhibits all the files in the selected directory. To test the file system controls pursue the steps given below:

1. Build a project.

2. Drag the drive list box, directory list box & the file list box from the tool box and drop on the form.

3. Place a text box on the form.

4. Handle the change event for the drive list box object. The object would be Drive1 by the default.

5. The Handle change event for the directory list box object. The object would be Dir1 by the default.

6. The Handle click the event for the file list box object. The object would be from File1 by the default.

7. The CurDir$ is a Visual Basic keyword. It is used to represent the path of the present directory, drive &file.

8. Handle form the load event. Now Code the form_load handler as shown below:

Private Sub Form_Load()

Drive1.Drive = CurDir$

Dir1.Path = CurDir$

File1.Path = CurDir$

File1.Pattern = "*.*"

End Sub

The keyword CurDir$ stores the selected drive's path in the Drive1 object. The data member drive holds the selected drive's path. The keyword CurDir$ stores the selected drive's path in the Drive1 object in the above code snippet. The data member Drive holds the selected drive's path. The keyword CurDir$ stores the path of the selected directory in the Dir1 object. The data member Path holds the selected directory's path. The keyword CurDir$ stores the selected file's path name in the File1 object. The data member Path holds the selected file's path name.

9. The Handle change the event for the Drive1 object. Now Code the handler as shown below.

Private Sub Drive1_Change()

Dir1.Path = Drive1.Drive

End Sub

Dir1.Path sets the path of the directory from the present drive.

10. Handle the change event for the Dir1 object. Code the handler as shown below.

Private Sub Dir1_Change()

File1.Path = Dir1.Path

End Sub

File1.Path sets the path of the file from the present directory.

11. The Handle click the event for the File1 object. Now Code the handler as revealed below.

Private Sub File1_Click()

Text1.Text = File1.FileName

End Sub

File1.FileName returns the selected file's name and that is stored in the text box

Text1.

918_file system control.png

Figure: File System Control

Posted Date: 10/9/2012 9:24:58 AM | Location : United States







Related Discussions:- File system controls, Assignment Help, Ask Question on File system controls, Get Answer, Expert's Help, File system controls Discussions

Write discussion on File system controls
Your posts are moderated
Related Questions
Displaying the file Without Scrolling: To display a file follow the steps as shown below: 1. Generate a SDI application. 2. Type the coding as shown in the Serialize els

GDI OBJECTS   The CDC provides 5 versions for the GDI objects. They are fonts, brushes, pens, bitmaps and regions. The Select Object function substitutes the current GDI objec

Message Routing: The system posts the messages to a first-in, first-out queue known as the message queue or it sends the messages directly to a window procedure. The Messages

Databound Controls - A controls use to display the contents of table using Data Control , have to bound each Control to the specific field and the controls are Known as the Data Bo

what are the things that information system can do and their limitations?

You are given a console program in both VB and C# that uses a class CElevator (ElevatorAppAssign). The main modules are in the assign directory class files. Below is a discus

For reason of readability & consistency, employ the following prefixes along with descriptive names for variables in your VBScript code. S ub type Prefi

write a XML with database with book details( book id, author ,subject, published year, vendor,price, language )

Variable Scope Prefixes As script size rise, so does the value of being capable to rapidly differentiate the scope of variables. A one-letter scope prefix preceding type prefix

- I have the chapter 5 project completed already. This is due tomorrow. Modify the Very Very .Boards project from Chapter 5 to separate the user interface from the business logic.