help with ListView please!

Discussion in 'Programming General' started by hmm, Jun 12, 2007.

help with ListView please!
  1. Unread #1 - Jun 12, 2007 at 1:16 AM
  2. hmm
    Joined:
    Jan 21, 2007
    Posts:
    181
    Referrals:
    2
    Sythe Gold:
    5

    hmm Active Member

    help with ListView please!

    [​IMG]
    http://i7.tinypic.com/5x5zy52.jpg

    im wondering how i could add text into seperate columns while the program is running..i can only get something to be added into column1 but not column2 & 3..if anyone could help that'd be great!
     
  3. Unread #2 - Jun 12, 2007 at 3:05 AM
  4. Flaming Idiots
    Joined:
    Dec 22, 2005
    Posts:
    235
    Referrals:
    1
    Sythe Gold:
    0
    Two Factor Authentication User

    Flaming Idiots Active Member
    Visual Basic Programmers

    help with ListView please!

    Here is a sub that can do it

    Code:
        Sub AddRow(ByVal ListView As ListView, ByVal ParamArray Columns() As String)
            ListView.Items.Add(New ListViewItem(Columns))
        End Sub
    And here is how to use it:
    Code:
    AddRow(Me.ListView1, "Column1", "Column2", "Column3", "Column4", "...")
    ' You can as many strings as you want.
     
  5. Unread #3 - Jun 12, 2007 at 12:56 PM
  6. hmm
    Joined:
    Jan 21, 2007
    Posts:
    181
    Referrals:
    2
    Sythe Gold:
    5

    hmm Active Member

    help with ListView please!

    that didnt work too well when in view mode:details.

    also i think that adds columns, i want to be able to add things under the columns...sorry if i confused you

    edit: an example of what i want it to do it like swiftswitchs price lookup for zybez..
     
  7. Unread #4 - Jun 12, 2007 at 7:42 PM
  8. speljohan
    Joined:
    Apr 24, 2005
    Posts:
    1,450
    Referrals:
    3
    Sythe Gold:
    0

    speljohan Guru
    Visual Basic Programmers

    help with ListView please!

    You mean add rows to it. I just wrote this function, it should work:
    Code:
        Public Sub AddRow(ByVal list As ListView, ByVal ParamArray cols() As String)
            Try
                list.Items.Add(cols(0))
                If Not cols.Length > list.Columns.Count() Then
                    For i As Integer = 1 To cols.Length - 1
                        list.Items(list.Items.Count() - 1).SubItems.Add(cols(i))
                    Next
                Else
                    MsgBox("Error! More values than columns.")
                End If
            Catch ex As Exception
                MsgBox("Error!")
            End Try
        End Sub
    End Sub
     
  9. Unread #5 - Jun 15, 2007 at 12:54 PM
  10. hmm
    Joined:
    Jan 21, 2007
    Posts:
    181
    Referrals:
    2
    Sythe Gold:
    5

    hmm Active Member

    help with ListView please!

    that is pretty cool, thanks man.
    i tried googling it and everything there seemed so complicated..
     
< puttung together bitmaps | Hello all >

Users viewing this thread
1 guest


 
 
Adblock breaks this site