hi

i don't know where the problem

i have forum contain listview

i want change some value in this listview from class example

Public Class Test
    Private Shared vidlist As Integer = 1
    Public Shared Sub Hello()

    Try
    start:

    If CInt(frmMethod1.ListView2.Items.Item(vidlist).SubItems(1).Text) < CInt(frmMethod1.ListView2.Items.Item(vidlist).SubItems(2).Text) Then

    '..

    ElseIf CInt(frmMethod1.ListView2.Items.Item(vidlist).SubItems(1).Text) >= CInt(frmMethod1.ListView2.Items.Item(vidlist).SubItems(2).Text) Then

    frmMethod1.ListView2.Items.Item(vidlist).BackColor = Color.Green
    frmMethod1.ListView2.Items.Item(vidlist).SubItems(3).Text = "Finished..."
    vidlist = vidlist + 1

    GoTo start
    End If

    Catch ex As Exception

    End Try

    End Sub
    End Class

i get this error

invalidargument=value of "1" is not valid for 'index'.parameter name:index

class don't see any items in listview

any help?

thanks

How many items do you have in your ListView? Use the debugger and put a breakpoint at line 8 then compare your ListView items with the index. Also, get rid of the goto. If you must use a loop then use a structured loop.

It sounds like your listview is out of scope. It's impossible to tell based on the little code you provided. Why not just implement the code as a function rather than as a class since the listview is external to the class anyway?

This article has been dead for over six months. Start a new discussion instead.