How to check a directory exits or not in vb.net?
In this tutorial you can learn how to check a directory exits or not (to check whether the directory is there or not)using vb.net.
In this tutorial you can learn how to check a directory exits or not (to check whether the directory is there or not)using vb.net.
Syntax:
First you have to import system.io then
Directory.exits(dir path) As Boolean
Dir pathà where the directory path is and output is true or false
Ex:”c:\newtest “ if this directory exits then written true or else false
To do this event following steps should follow if you know ignore these steps
Step1:
Drag and drop button1, label1, 2,textbox1
Button1àcheck
Label1àenter the path
Labelàeg:c:\newfolder
Double click the button and copy and paste the following code
Code:
Imports System.IO
Public Class Form1
Private SubButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click
If Directory.Exists(TextBox1.Text) = True Then
MessageBox.Show("Directory already created")
Else
MessageBox.Show("Directory is not there")
End If
End Sub
End Class
Optput:
No comments:
Post a Comment