On one of my forms i have a listview and items get added to the listview when the "add" button is clicked.
Heres the basic idea of the code
Dim itmx as listview
set itmx = listview1.listitems.add
itmx.text = cbo1.text
itmx.subitems(1) = cbo2.text
itmx.subitems(2) = cbo3.text
cbo1.text = ""
cbo2.text = ""
cbo3.text = ""
All items get added to the listview perfectly fine the very first time the add button is clicked. If itmx.text is blank then records get added in order, each addition gets added below the previous one
However, if itmx.text from the first entry contains any character, the second time the add button is selected, the second set of information gets added ABOVE the first one, when this should be below the first one.
The reason: This line of code seems to set the blank line above the first record.
set itmx = listview1.listitems.add
For example:
First time through:
cbo1.text = "test1"
cbo2.text = "test2
cbo3.text = "test3"
itmx.text = "test1"
itmx.subitem(1) = "test2"
itmx.subitem(2) = "test3"
Listview: (pipeline represents column)
line one: test1 | test2 | test 3
Second time the add button is clicked
cbo1.text = "test4"
cbo2.text = "test5"
cbo3.text = "test6"
itmx.text = "test4"
itmx.subitem(1) = "test5"
itmx.subitem(2) = "test6"
line one: test4 | test5 | test 6
line two: test1 | test2 | test 3
When it should be:
line one: test1 | test2| test3
line two: test4 | test5 | test6
Can anyone offer any suggestions as to why this occurs? Any help would be greatly appreciated.
Heres the basic idea of the code
Dim itmx as listview
set itmx = listview1.listitems.add
itmx.text = cbo1.text
itmx.subitems(1) = cbo2.text
itmx.subitems(2) = cbo3.text
cbo1.text = ""
cbo2.text = ""
cbo3.text = ""
All items get added to the listview perfectly fine the very first time the add button is clicked. If itmx.text is blank then records get added in order, each addition gets added below the previous one
However, if itmx.text from the first entry contains any character, the second time the add button is selected, the second set of information gets added ABOVE the first one, when this should be below the first one.
The reason: This line of code seems to set the blank line above the first record.
set itmx = listview1.listitems.add
For example:
First time through:
cbo1.text = "test1"
cbo2.text = "test2
cbo3.text = "test3"
itmx.text = "test1"
itmx.subitem(1) = "test2"
itmx.subitem(2) = "test3"
Listview: (pipeline represents column)
line one: test1 | test2 | test 3
Second time the add button is clicked
cbo1.text = "test4"
cbo2.text = "test5"
cbo3.text = "test6"
itmx.text = "test4"
itmx.subitem(1) = "test5"
itmx.subitem(2) = "test6"
line one: test4 | test5 | test 6
line two: test1 | test2 | test 3
When it should be:
line one: test1 | test2| test3
line two: test4 | test5 | test6
Can anyone offer any suggestions as to why this occurs? Any help would be greatly appreciated.