F
Flying Whiz
I am trying to show a message when there are no Text files in the List
box.But every time it is showing me the message even if there are text
files in the listbox.How can I do this.
This is the code I am trying to use.
Dim StrFiles() As String
Dim StrFile As String
StrFiles = System.IO.Directory.GetFiles("\Program Files\Dev_Tool\",
"*.txt")
If StrFile = "" Then
MsgBox("Copy the 'txt' file in '\Program Files\Dev_Tool\'
folder and then run the application again", vbOKOnly, "Error Message")
Application.Exit()
Else
For Each StrFile In StrFiles
ListBox1.Items.Add(System.IO.Path.GetFileName(StrFile))
Next
End If
Thanks
Whiz
box.But every time it is showing me the message even if there are text
files in the listbox.How can I do this.
This is the code I am trying to use.
Dim StrFiles() As String
Dim StrFile As String
StrFiles = System.IO.Directory.GetFiles("\Program Files\Dev_Tool\",
"*.txt")
If StrFile = "" Then
MsgBox("Copy the 'txt' file in '\Program Files\Dev_Tool\'
folder and then run the application again", vbOKOnly, "Error Message")
Application.Exit()
Else
For Each StrFile In StrFiles
ListBox1.Items.Add(System.IO.Path.GetFileName(StrFile))
Next
End If
Thanks
Whiz