I am working with the ListView Control and I have three columns. In my first column I have placed an image. In the second column I have placed some text as a sub item. So far so good. My difficulty is in placing text in the third column.
I know that by default, if an image is added it appears in the first column with the first list item to its right in the same column. I do not want text in the first column so I added an empty string like lstMyListView.Items.Add("",0) . Anyway that part works fine.
My difficulty is in adding a second sub item which should go in the third column. When I run the code as shown below, it properly places the image in the first column, the text from txtItems.text in the second column. However, it places the text from txtDescription.text in the second column one line below rather than in the adjacent third column.
Can you tell me where I am going wrong?
I look forward to your reply and as always, I really appreciate your help.
The code for my work is below:
Public Class Form1
Private Sub btnAddDescription_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddDescription.Click
'Defines the Index Variable
Dim Index As Integer
Index = txtIndex.Text
'Defines the Items Variable
Dim Items As String
Items = txtItems.Text
'Defines the Description Variable
Dim Description As String
Description = txtDescription.Text
'Adds an image to the first column without any string of text and Adds Text from TextBox1
Dim objListItem As ListViewItem
objListItem = lstMyListView.Items.Add("", Index)
Dim objListItem2 As ListViewItem
objListItem2 = lstMyListView.Items.Add(Items)