Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Certain files in listbox

Posted on 2003-11-26
6
174 Views
Last Modified: 2010-05-03
Hi,
Im working on a file sharing program.
I want it so when the person views the host's files, all they see are .txt and .log

here is the part listing it


Private Sub fillDir(Incoming As String)

Dim i As Integer
Dim strCut As String

    cutString strCut, Incoming
    i = Val(strCut)
   
    If i > 1 Then
        For i = 1 To i - 1
             cutString strCut, Incoming
             lstFiles.AddItem strCut
        Next i
    End If
   
    lstFiles.AddItem Incoming
    lstFiles.ListIndex = 0
End Sub

0
Comment
Question by:raptorpb1
  • 2
  • 2
  • 2
6 Comments
 
LVL 9

Expert Comment

by:p_sie
ID: 9830261
For i = 1 To i - 1
         cutString strCut, Incoming
         IF Right(StrCut,4) <> ".txt" AND Right(StrCut,4) <> ".log" Then
                      lstFiles.AddItem strCut
         End If
Next i
0
 

Author Comment

by:raptorpb1
ID: 9830310
Doesn't work. I still see all the files
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 450 total points
ID: 9830373
For i = 1 To i - 1
        cutString strCut, Incoming
        IF Right(StrCut,4) = ".txt" OR Right(StrCut,4) = ".log" Then
                     lstFiles.AddItem strCut
        End If
Next i
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 9

Expert Comment

by:p_sie
ID: 9830426
Sorry, i read it wrong
did think you didn't want .txt and .log.
0
 

Author Comment

by:raptorpb1
ID: 9830590
Thank You
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9830638
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question