Hello,
The concept goes like this: The user selct n number of rows in a listview, and then right-click the mouse, and select an item from the popup menu. How many items - and which one - the user selected, and the text to display in the columns 1, 2 and 3, is determined in the sub shown below. So far, so good.The problem is that I can't see a way to get the text into the listview, and I don't know what triggers the DrawItem event in this case - control is Ownerdrawn.
I would be grateful for some hint to point me into the right direction in this matter.
Thanks for your help!
--
Doffen
Private Sub SettInnHToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SettInnHToolStripMenuItem.Click
'Dim indexes As ListView.SelectedIndexCollection = Me.Listview1.SelectedIndices
Dim index, idx As Integer For index = 0 To Listview1.SelectedIndices.Count - 1 For idx = 0 To 2 ' What text to display in column 1,2 and 3Listview1.Items.Item(idx).Text = Mid$(
"abc", idx + 1, 1) 'Shows the item indexes selected, and the text to display in each coulum in that item(row)MsgBox(Listview1.SelectedIndices.Item(index) &
" " & Listview1.Items.Item(idx).Text) Next NextEnd Sub

Display text in an ownerdrawn listview - again.
orent
For index As Integer = 0 To ListView1.SelectedIndices.Count - 1
For column As Integer = 0 To 2
ListView1.Items(index).SubItems(column).Text = Mid$("abc", column + 1, 1)
Next
Next
Make sure that you've created the SubItems. The painting will take care of itself.
YFell
Hello,
Many thanks for your reply. Yes, it got painted this time, but the text got inserted into the wrong items(rows). Actually item 0,1 and 2. After changing the code - see below - it all now works like a charm.
Again - many thanks for you help!
--
Doffen
Private
Sub SettInnHToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SettInnHToolStripMenuItem.Click Dim indexes As ListView.SelectedIndexCollection = Me.Listview1.SelectedIndices For Each idx As Integer In indexes For column As Integer = 1 To 3Listview1.Items(idx).SubItems(column).Text = Mid$(
"abc", column, 1) Next Next End Sub