Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am using the the following to fill a listview. There are two i was hoping someone could please help me with.

 

1) For some reason the very top (1st) line is kept blank and the first row that is filled is the 2nd row. (I presume the listview starts at row 0, and this is the problem). How can i fill the 1st line please?

 

2) item.SubItems(0).Text = ("A" & i) I would like to create this using the same method as i do the rest of the columns, but it wont work. Row 0 problems again.

 

For i As Integer = 1 To 100
Dim item As New ListViewItem

item.SubItems(0).Text = ("A" & i)
item.SubItems.Add("B" & i)
item.SubItems.Add("C" & i)
item.SubItems.Add("D" & i)
item.SubItems.Add("E" & i)
ListView1.Items.Add(item)
Next i

 

Thanks.

Posted
'Start at 0 to populate the very first row
For i As Integer = 0 To 100
'Set the items first column text
   Dim item As New ListViewItem("A" & i)
'Set the other columns
   item.SubItems.Add("B" & i)
   item.SubItems.Add("C" & i)
   item.SubItems.Add("D" & i)
   item.SubItems.Add("E" & i)
   ListView1.Items.Add(item)
Next i 

Visit: VBSourceSeek - The VB.NET sourcecode library

 

 

"A mere friend will agree with you, but a real friend will argue."

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...