Check If Folder Exist Or Not Using VB.NET

Folder Checks Are Required During Verifying Installations & Updates , File Creations etc. We can check folder exist or not in VB.NET by importing System.IO namespace as we did in File check [Previous Post : Check If File Exist Or Not Using VB.NET ]

Code :

For Declaration :
Import System.IO

On Button Click, Form Load Etc ;

If Directory.Exists("MyFolder") Then




End if

For Example , We are checking a folder named as "MyFolder" , The complete code is provided below:

Complete Code :

Image For Reference :

When 'Button1' Will Be Clicked , It Will Check That Given Directory [Folder] Exist Or Not & According to Its Condition It Will Perform Its Operation , As Here It Will Show Message.