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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, In my project I have a filelis

Status
Not open for further replies.

user0001

Programmer
Jul 31, 2001
9
BE
Hi,
In my project I have a filelistbox which has the property multiselect on extended.
When I run the program and I select a few files, i get the following error :
'run-time error 381 : invalid property array index'

For intCounter = 0 To filFile.ListCount-1
If filFile.Selected(intCounter) = True Then
DoEvents
filFile.ListIndex = intCounter 'error appears
strflnm = dirFolder.Path & "\" & filFile.FileName
ExecScripts (strflnm)
end if
Next intCounter

Everything works until the counter arrives at the first item selected in the list. At that moment, the listindex has the value of the last selected item in the list. When I try to assign another value (index from the first selected item) it gives the error. Does somebody know what is happening here ?!?
Thanks in advance!
 
ListIndex acts differently when the MuliSelect property is set to extended. It returns the index of the item contained within the focus rectangle, whether or not that item is actually selected. Since your intent is to retrieve a selected filename, you can use List() to get the selected filename:

If filFile.Selected(intCounter) = True Then
DoEvents
strflnm = dirFolder.Path & "\" & filFile.List(intCounter)
.
.
.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top