Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- TextBox1.Clear()
- Timer1.Start()
- FolderBrowserDialog1.ShowDialog()
- End Sub
- Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- If TextBox1.Text$ = vbNullString Then
- TextBox1.Text$ = FolderBrowserDialog1.SelectedPath
- Else
- Timer1.Stop()
- End If
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Dim f As Integer = 0
- Dim fo As Integer = 0
- Dim files As Object = My.Computer.FileSystem.GetFiles(TextBox1.Text$)
- Dim folders As Object = My.Computer.FileSystem.GetDirectories(TextBox1.Text$)
- For Each file In files
- f += 1
- Next
- For Each folder In folders
- fo += 1
- Next
- If f > 0 And fo = 0 Then
- MsgBox("There are " & f & " file(s) on this directory", MsgBoxStyle.Information)
- ElseIf f = 0 And fo > 0 Then
- MsgBox("There are " & fo & " folder(s) on this directory", MsgBoxStyle.Information)
- ElseIf f > 0 And fo > 0 Then
- MsgBox("There are " & f & " file(s) and " & fo & " folder(s) on this directory", MsgBoxStyle.Information)
- ElseIf f = 0 And fo = 0 Then
- MsgBox("There are no files/folders on this directory", MsgBoxStyle.Information)
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement