Hello everyone, last tutorial we learn how to make a specific file using visual basic 2010. Today we are going to make folder or directory.
According to wikipedia.org - In computing, a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories. On many computers directories are known asfolders, catalogs (used on the Apple II, the Commodore 128 and some other early home computers as a command for displaying disk contents - the filesystems used by these DOS did not support hierarchal directories), or drawers to provide some relevancy to a workbench or the traditional office file cabinet. On Microsoft Windows, the terms folder and directory are used interchangeably
According to wikipedia.org - In computing, a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories. On many computers directories are known asfolders, catalogs (used on the Apple II, the Commodore 128 and some other early home computers as a command for displaying disk contents - the filesystems used by these DOS did not support hierarchal directories), or drawers to provide some relevancy to a workbench or the traditional office file cabinet. On Microsoft Windows, the terms folder and directory are used interchangeably
How can I make a folder or directory in visual basic
Creating a directory in visual basic is simple as ABC and 123, the code you need is just a simple 1 line code..
If you want to create a static directory with fix folder name and place to save in, you will need this code.
My.Computer.FileSystem.CreateDirectory("C:\myfolder")
You can add a message box for notification when the folder is created. note that this is a fixed folder with file name and a C:\ drive where the folder will be saved..
If you want to create a dynamic folder with user defined folder name and drive to save it you can modify the code, but before this you must add some controls. Add the following controls to your project.
1 Combobox 'list all the drives where you want to save the folder
1 Textbox 'this will be used to type the folder name
1 Button 'this will serve as the main command to create the folder
Your program must look like this |
Once all the controls have been placed and aligned, you can now start writing this code at the button1_click event.
My.Computer.FileSystem.CreateDirectory(ComboBox1.Text + Textbox1.Text)
you can also add a message box for notification whether the folder was created.