How to Apply Filter to IEnumerator

  • Thread starter Thread starter thunder$truck
  • Start date Start date
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$
 
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$
 
Duh..of course... InStr for .log against en...

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

Thanks,
T$
 
Back
Top