Message 1 of 3
Listbox problems

Not applicable
03-03-2001
07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm a novice VB / VBA person and I've run into yet another roadblock.
I'm trying to move a group of drawing files from one listbox (that displays
the total list of files in a subdirectory) to another. This second listbox
is the group of drawings I'm going to perform the operation on.
the problem is: I keep getting an "invalid property array index" error
(code 381) in the section of code that removes the selected items (after its
added to the second listbox). My code, as far as I know, is in accordance
with every book and reference I've seen. What am I doing wrong ?
Dim i As Integer
For i = 0 To filelist.ListCount - 1
If filelist.Selected(i) Then
lstDrawings.AddItem dirname & filelist.List(i)
End If
Next i
Dim k As Integer
For k = 0 To filelist.SelCount - 1
If filelist.Selected Then <<< this is where the error
code is initiated
filelist.RemoveItem (k)
End If
Next k
The second section of code is where the error occurs (see my comment to the
right of the code).
If you have a suggestion, please email: nimzondn@mindspring.com
or just post your recommendations
thanks
jm
I'm trying to move a group of drawing files from one listbox (that displays
the total list of files in a subdirectory) to another. This second listbox
is the group of drawings I'm going to perform the operation on.
the problem is: I keep getting an "invalid property array index" error
(code 381) in the section of code that removes the selected items (after its
added to the second listbox). My code, as far as I know, is in accordance
with every book and reference I've seen. What am I doing wrong ?
Dim i As Integer
For i = 0 To filelist.ListCount - 1
If filelist.Selected(i) Then
lstDrawings.AddItem dirname & filelist.List(i)
End If
Next i
Dim k As Integer
For k = 0 To filelist.SelCount - 1
If filelist.Selected Then <<< this is where the error
code is initiated
filelist.RemoveItem (k)
End If
Next k
The second section of code is where the error occurs (see my comment to the
right of the code).
If you have a suggestion, please email: nimzondn@mindspring.com
or just post your recommendations
thanks
jm