Creating folders using vb.net

directory, vb.net

Solution

Are you looking for something like this?

Private Sub CreateBTN_Click(sender As Object,
                            e As EventArgs) Handles CreateBTN.Click
    Dim sPath As String = IO.Path.Combine(txtPath.Text, txtFolderName.Text)
    If Not IO.Directory.Exists(sPath) Then
        IO.Directory.CreateDirectory(sPath)
        MsgBox("folder created")
    Else
        MsgBox("Folder already exist")
    End If
End Sub

Problem

I'm starting on a program that creates a folder this is what i currently have, now what i want to do is to have two textboxes, one textbox is for the directory and the other is for the folder name, how can i implement that here? ``` Private Sub CreateBTN_Click(sender As Object, e As EventArgs) Handles CreateBTN.Click Dim Path As String = txttargerdirectory.Text If Not Directory.Exists(Path) Then Directory.CreateDirectory(Path) MsgBox("folder created") Else MsgBox("Folder already exist") End If End Sub ```

Original source