I have a checked listbox ( Layerlijst) with the layernames of my draftfile and i want to show only the checked layers.
I use this code to walk trough the list for show or hide my layers:
' Only show selected layers
For m = 1 To objLayers.Count
objLayer = objLayers.Item(m)
If Layerlijst.GetItemCheckState(m) Then
objLayer.Show = True
objLayer.Show = False
When it reaches the last item of the listbox i get an error message on Layerlijst.GetItemCheckState(m)
Invalid argument: Value of 13 is not valid for index.
Can anyone tell me what i do wrong?
Posted by: Patrick KellerPost date: 3/20/2009 2:47:00 AM
Assuming that you're using VB.NET, arrays are zero based. COM API's are one based. VB 6 was one based.
Posted by: Jason NewellPost date: 3/20/2009 7:17:56 AM
I understand what u mean Jason and i found out what i did wrong.
After filling my listbox i created a temp layer so my actual layer count was 1 higher then my listbox.
Posted by: Patrick KellerPost date: 3/20/2009 9:37:52 AM