How to add Listview subitem with For Loop
-
Dear Expert, I have a Listview with subitem which i add populate data in listview which is lengthy, i want to shorten the code, i tried For loop but it give me error at run time. With Do loop it working.
Do Until rs.EOF = True
Set LI = ListView1.ListItems.Add(, , rs(0))'For x = 1 To 16 'LI.SubItems(i) = rs(x) 'Next x LI.SubItems(1) = rs(1) LI.SubItems(2) = rs(2) LI.SubItems(3) = rs(3) LI.SubItems(4) = rs(4) LI.SubItems(5) = rs(5) LI.SubItems(6) = rs(6) LI.SubItems(7) = rs(7) LI.SubItems(8) = rs(8) LI.SubItems(9) = rs(9) LI.SubItems(10) = rs(10) LI.SubItems(11) = rs(11) LI.SubItems(12) = rs(12) LI.SubItems(13) = rs(13) LI.SubItems(14) = rs(14) LI.SubItems(15) = rs(15) LI.SubItems(16) = rs(16) rs.MoveNext Loop
-
Dear Expert, I have a Listview with subitem which i add populate data in listview which is lengthy, i want to shorten the code, i tried For loop but it give me error at run time. With Do loop it working.
Do Until rs.EOF = True
Set LI = ListView1.ListItems.Add(, , rs(0))'For x = 1 To 16 'LI.SubItems(i) = rs(x) 'Next x LI.SubItems(1) = rs(1) LI.SubItems(2) = rs(2) LI.SubItems(3) = rs(3) LI.SubItems(4) = rs(4) LI.SubItems(5) = rs(5) LI.SubItems(6) = rs(6) LI.SubItems(7) = rs(7) LI.SubItems(8) = rs(8) LI.SubItems(9) = rs(9) LI.SubItems(10) = rs(10) LI.SubItems(11) = rs(11) LI.SubItems(12) = rs(12) LI.SubItems(13) = rs(13) LI.SubItems(14) = rs(14) LI.SubItems(15) = rs(15) LI.SubItems(16) = rs(16) rs.MoveNext Loop
-
Dear Sir, is this the right path to display listview subitems with for loop
Li.SubItems(x) = rs(x)
-
Dear Sir, is this the right path to display listview subitems with for loop
Li.SubItems(x) = rs(x)
-
Dear Sir, It work. But i just want to know it will affect the other program when compile or not.
-
Dear Sir, It work. But i just want to know it will affect the other program when compile or not.