Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working my way through a filelistbox!! 1

Status
Not open for further replies.

DaTommyboY

Programmer
Feb 10, 2004
40
NL
Hello everybody,

I have a filelistbox on my form which is filled with files, nothing weird sofar. What i like to do is get the name of the first file in the filelistbox and compair it with another string. If the match, take the next file from the filelistbox and compair it again, till a difference is found!!
I was thinking about something like this, but it dont work

Dim QQ, RR as integer
Dim TT as sting

RR = filelistbox.listcount
TT = JustAStringToCompair

for QQ = 1 to RR
if filelistbox.index(RR) = TT
next QQ
else
Do something else
exit for
end if

the command filelistbox.index() or filelistbox.tabindex() wont do what I expected him to do!!!

Can somebody help me
Thanks many many times

****** Tractor Pulling ******
The most powerfull motorsport
in the world!!!
 
Change

for QQ = 1 to RR

to

for QQ = 0 to RR - 1 step 1

and

if filelistbox.index(RR) = TT

to

if filelistbox.index(QQ) = TT

mmilan.
 
HI MMilan,

Thanks fore your response but no luck!!!
Still the same result, the error I get is:

Compile error:

Wrong number of arguments or invalid property assignment

It seems that the filelistbox does not support the .index() option. I like that the filelistbox returns the name of the file which is on index(0) ore index(5) ore anything else.

Thanks again and hope to get some good hints!!
Tom

****** Tractor Pulling ******
The most powerfull motorsport
in the world!!!
 
Try this
Code:
Dim QQ, RR As Integer
Dim TT As String

RR = FileListBox.ListCount
TT = "JustAStringToCompair"

For QQ = 0 To RR - 1 Step 1
    
    If FileListBox.List(QQ) = TT Then
        'Do something in here
    Else
        'Do something else
        Exit For
    End If
Next QQ

Not sure of your logic, but you'll find the FileList stuff works.
 
Haï mmilan,

Works like a charme......
Thank you,that was the command of function I needed. Give you a star for that!! Deal!!

Tom

****** Tractor Pulling ******
The most powerfull motorsport
in the world!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top