• Log in or sign up for an account here: https://www.sythe.org/login

help with ListView please!

hmm

Active Member
Joined
Jan 21, 2007
Sythe Gold
5
Messages
181
5x5zy52.jpg

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!
 
Two Factor Authentication User
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.
 
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..
 
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
 
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

that is pretty cool, thanks man.
i tried googling it and everything there seemed so complicated..
 
duelarena.gg
Back
Top