How to Apply Filter to IEnumerator

T

thunder$truck

Any Ideas on how to modify this sub-routine to enumerate, say, only
*.log files as oppossed to the entire path? I've tried several things
but have thus far resulted in furthur frustration.

Private Sub ShowLogFiles()
Try
Dim path As String = TextBox1.Text
Dim d() As String

d = System.IO.Directory.GetFiles(path)

Dim en As System.Collections.IEnumerator
en = d.GetEnumerator

While en.MoveNext
Results.Items.Add(CStr(en.Current))
End While

Catch
MsgBox(Err.Description)
End Try
End Sub

Thanks,
T$
 
G

Greg Young

sure check to see if its *.log before adding it to results.

thunder$truck said:
Any Ideas on how to modify this sub-routine to enumerate, say, only
*.log files as oppossed to the entire path? I've tried several things
but have thus far resulted in furthur frustration.

Private Sub ShowLogFiles()
Try
Dim path As String = TextBox1.Text
Dim d() As String

d = System.IO.Directory.GetFiles(path)

Dim en As System.Collections.IEnumerator
en = d.GetEnumerator

While en.MoveNext
Results.Items.Add(CStr(en.Current))
End While

Catch
MsgBox(Err.Description)
End Try
End Sub

Thanks,
T$
 
T

thunder$truck

Duh..of course... InStr for .log against en...

I knew a fresh set of eyes would do me some good.

Thanks,
T$
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top