Results 1 to 4 of 4

Thread: Adding Row in ListView VB.NET

  1. #1

    Thread Starter
    Hyperactive Member vincentg's Avatar
    Join Date
    Jun 2005
    Location
    Chicago IL, USA
    Posts
    261

    Adding Row in ListView VB.NET

    Hi,
    I have a List View in my form name lstVContent. I have a code that adds a columns programmatically but I dont know yet to add a row in it. Any help will greatly appreciated. Thanks.

    -Vincentg
    '----------------------------------------------------------------------
    Sub SetListView()

    Me.lstVContent.View = View.Details
    Me.lstVContent.Columns.Add("Column1",100,HorizontalAlignment.Center)
    Me.lstVContent.Columns.Add("Column2", 100, HorizontalAlignment.Left)
    Me.lstVContent.Show()
    End sub
    '----------------------------------------------------------------------
    Private Sub frm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Call SetListView()
    End Sub

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Adding Row in ListView VB.NET

    Listview1.Items.Add(...)

  3. #3

    Thread Starter
    Hyperactive Member vincentg's Avatar
    Join Date
    Jun 2005
    Location
    Chicago IL, USA
    Posts
    261

    Re: Adding Row in ListView VB.NET

    It did not show the row added..I add already -> Me.lstVContent.Refresh()....

  4. #4

    Thread Starter
    Hyperactive Member vincentg's Avatar
    Join Date
    Jun 2005
    Location
    Chicago IL, USA
    Posts
    261

    Re: Adding Row in ListView VB.NET

    Thanks.... I got it.....
    Just need to put

    ObjItemList.SubItems.Add("column2")
    ObjItemList.SubItems.Add("column3")
    ....

    because I have lots of columns.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width