-
i am writing a program that saves information
to a text file with a UDT that i put into an
array.
i load these items in a listbox with the array.
however, when one is deleted, a blank line is shown
in the listbox.
how can i completely remove this dead space
from my array?
thankx in advance,
larryn
-
Two options:
1. Create a new array, and copy the contents into it, missing out the dead one.
2. Use a Collection - they support add/remove and all the rest.
-
Or you could also check for blank items while loading the array into the listbox´.
-
along the lines of this?
Code:
For LBound(array) to UBbound(array)
If array(iX) = "" Then
'what here?
End If
Next
-
Then you would have to put another counter for reading and shuffling the array to i1.
Code:
For i1= LBound(array) to UBbound(array)
If array(i1) then exit for
Next i1
i2=i1
For i1 = i1 to UBbound(array)
If array(i1) = "" Then i2=i2+1
array(i1)=array(i2)
i2=i2+1
if i2>ubound(array) then exit for
Next
-