For Each f As FileInfo In folder.GetFiles
Try
'try to open each file for read
f.OpenRead()
'f.openRead.close
'f.openRead.dispose
'catch error
Catch c As Exception
'permissions issue, skip file
GoTo nxt2
End Try
'check if file is a sql file
If f.Name.Substring(Len(f.Name) - 4, 4) = ".sql" Then
'file is a sql file
cmbscript.Items.Add(f.Name.Replace(".sql", ""))
End If
nxt2:
Next
|