CreateDirectory In Visual baisc
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not TextBox1.Text = String.Empty Then
Dim dirinf As DirectoryInfo
dirinf = New DirectoryInfo(TextBox1.Text)
Try
dirinf.Create()
Catch ex As IOException
MsgBox("tak dapat create directory" & vbCrLf & ex.Message)
Catch ex1 As UnauthorizedAccessException
MsgBox(" tak boleh create directory" & TextBox1.Text)
End Try
'cara kedua
'Directory.CreateDirectory(TextBox1.Text)
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Not TextBox1.Text = String.Empty Then
Dim dirinf As DirectoryInfo
dirinf = New DirectoryInfo(TextBox1.Text)
Try
dirinf.Delete()
Catch ex As IOException
MsgBox("tek boleh delete")
End Try
'cara kedua
'Directory.Delete(TextBox1.Text)
End If
End Sub
End Class
CreateDirectory In Visual baisc
.
Categories
- ASP (4)
- HTML (4)
- JavaScript (4)
- PHP (4)
- Visual Basic (4)
- XML (5)
Popular Posts
-
The following console program is the Visual Basic version of the traditional "Hello, World!" program, which displays the string ...
-
change button color in visual basic Public Class Form1 Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows...
-
XML Attribute Values Must be Quoted XML elements can have attributes in name/value pairs just like in HTML. In XML, the attribute values...
-
A message box when page opens (Javascript Code) You can bring a message box or a alert a window which tell something to user at the first ...