Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add sub items in listview

Status
Not open for further replies.

Shift838

IS-IT--Management
Jan 27, 2003
987
US
i have a listview with 4 columns. I am importing the items from a text file that go in column 1. How can I add a subitem to each row for a specific item in column 1 to be say updated (added) in column 2.
 
i figured this out with the below code:

the currentdt variable is a publich variable set for datetime of:

Public currentdt As DateTime = DateTime.Now

Code:
Private Sub cmdStartPing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStartPing.Click
        Dim serverlist, x As Integer
        Dim servers As String
        Dim response As New ListViewItem

        serverlist = lstServers.Items.Count - 1

        For x = 0 To serverlist

            servers = lstServers.Items(x).Text
            MultiPingSystem(servers)

            If pingresults = "Success" Then
                lstServers.Items(x).BackColor = Color.GreenYellow
                lstServers.Items(x).SubItems.Add("Success")
                lstServers.Refresh()
                lstServers.Items(x).SubItems.Add(roundtriptime)
                lstServers.Refresh()
            Else
                lstServers.Items(x).BackColor = Color.Red
                lstServers.Items(x).SubItems.Add("No Reply")
                lstServers.Refresh()
                lstServers.Items(x).SubItems.Add("Timeout")
                lstServers.Refresh()
                lstServers.Items(x).SubItems.Add(currentdt)
                lstServers.Refresh()

            End If
        Next

    End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top