Ladies & Gents,
I have a number of listviews setup in my application. The variable 'tableno' is already set elsewhere as a string value between 1 & 6 and the following code works when I want to move all listview1 items into a specific tablelist listview.
I tried to tidy the code up with this:
But I get the error: 'items' is not a member of 'System.Windows.Forms.Control'
I'm sure there must be a way to tidy the code up so, please, what am I doing wrong?
Thanks
John
I have a number of listviews setup in my application. The variable 'tableno' is already set elsewhere as a string value between 1 & 6 and the following code works when I want to move all listview1 items into a specific tablelist listview.
Code:
For Each itm In ListView1.Items
Dim newItm As ListViewItem = itm.Clone
Select Case tableno
Case "1"
tablelist1.Items.Add(newItm)
Case "2"
tablelist2.Items.Add(newItm)
Case "3"
tablelist3.Items.Add(newItm)
Case "4"
tablelist4.Items.Add(newItm)
Case "5"
tablelist5.Items.Add(newItm)
Case "6"
tablelist6.Items.Add(newItm)
End Select
Next
Code:
For Each itm In ListView1.Items
Dim newItm As ListViewItem = itm.Clone
Controls("tablelist" + tableno).items.add(newItm)
Next
I'm sure there must be a way to tidy the code up so, please, what am I doing wrong?
Thanks
John