hi sir,

when i adding items into the listview ,i have added serialno and 5 other columns ,so whenever i adding new item the serialno will increase one but my problem is when i removing a row from listview how to rearrange the serial numbers pls help me

I hope the following codes help you.

   Private Sub ButtondeleteListItem_Click(sender As System.Object, e As System.EventArgs) Handles ButtondeleteListItem.Click

            ''' First remove the selected items
            For Each litem As ListViewItem In ListView1.SelectedItems
                ListView1.Items.Remove(litem)
            Next

            ''' Check the items count is not zero
            If Not ListView1.Items.Count = 0 Then
                ''' modify the text of the item
                For Each litem As ListViewItem In ListView1.Items
                    litem.Text = "X" & (litem.Index + 1).ToString
                Next
            End If
        End Sub

Assuming you mean that you don't want a gap in the numbering. One way would be to loop through all the rows from the row you removed to the end and decrease the serial number by 1, for each row that's left

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.