Visual Basic is a robust computer language used in Windows and Microsoft applications to create complex interactive programs. The programming language can create stand-alone software, but it also allows algorithms to act on existing files and folders. The tool set of Visual Basic is extensive. Subroutines may be built to significantly alter the contents of a computer. Wild cards are a particularly versatile and powerful mechanism for creating programs that manipulate large sets of data without actually knowing the names of particular files. It is possible to use wild cards in folder names in Visual Basic.
- Skill level:
Things you need
- Visual Basic Editor
Type the folder name and its full path as part of a regular Visual Basic function, such as \"Kill.\" Enclose the folder name and path in quotes.
Replace part of the path with the wild card character, an asterisk (\"*\").
Type a file extension after the wild card to process a batch of similar file types within the folder without regards to individual file names. For example: Kill \"c:\vbfiles\*.txt\". The wild card is used to operate on the folder name \"vbfiles\" to process all text documents it contains.
Type a \"Dir()\" function to reference a folder name. This is a common Visual Basic function for specifying a particular directory or folder when calling outside files into the subroutine.
Use the wild card character, an asterisk, in the folder name path to open the function to multiple files.
Type a file extension after the wild card so the subroutine knows what to process in the folder. For example: Dir(\"C:\Windows\*.txt\").
Tips and warnings
- Be careful with wild cards. They can act on more data than the programmer initially realises. Using a wild card, it is possible to involve an unlimited amount of data in the subroutine. This can have catastrophic consequences if the subroutine alters or deletes data. Additionally, the program may run slowly if the wild card has access to thousands of files, or folders of enormous size. While the wild card is a useful tool, it is also powerful and potentially dangerous if implemented without consideration for all possible scenarios.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for