Solved

Certain files in listbox

Posted on 2003-11-26
6
173 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

803 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