Dear friends

Maybe can someone support me with this problem in VB6,
I don't know why the error "out of bounds" while adding values to the listview.

``````For k = 1 To datos.nels - 1
Dim nod1, nod2 As Integer
ReDim km(1 To Tipo.nodof * datos.nnod, 1 To Tipo.nodof * datos.nnod) As Double
nod1 = datos.Listbar.ListItems(k).SubItems(1)
nod2 = datos.Listbar.ListItems(k).SubItems(2)
For i = Tipo.nodof * (nod1 - 1) + 1 To Tipo.nodof * nod1
For j = Tipo.nodof * (nod2 - 1) + 1 To Tipo.nodof * nod2
km(i, i) = Lklocal.ListItems(6 * (k - 1) + i - Tipo.nodof * (nod1 - 1)).SubItems(i - Tipo.nodof * (nod1 - 1)) '+ km(i, i)
km(j, j) = Lklocal.ListItems(6 * (k - 1) + j - Tipo.nodof * (nod2 - 1)).SubItems(j - Tipo.nodof * (nod2 - 1)) '+ km(j, j)
km(i, j) = Lklocal.ListItems(6 * (k - 1) + i - Tipo.nodof * (nod1 - 1)).SubItems(j - Tipo.nodof * (nod2 - 1)) '+ km(i, j)
km(j, i) = Lklocal.ListItems(6 * (k - 1) + j - Tipo.nodof * (nod2 - 1)).SubItems(i - Tipo.nodof * (nod1 - 1)) ' + km(j, i)
Dim lgmi, lgmj As ListItem
Next j
Next i
Next k
``````
Sin-t-tulo.png
Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Older than dirtCommented:
The following is typical code for adding to a Listview. Notice that there no index value at the end of the ListItems.Add line.
``````Set itmX = lvFind.ListItems.Add(, , CStr(mrsProducts!ProductName))
itmX.SubItems(1) = CStr(mrsProducts!SupplierID)
itmX.SubItems(2) = mrsProducts!CategoryID
``````
0

Experts Exchange Solution brought to you by