for example i have 4 columns in the listview namely name,age,year and grade. the problem is this, how can i display an error message when i click the row when the grade = "fail" . help me please thank you :)

Handle the listview's Click event

Example:

    Private Sub ListView1_Click(sender As System.Object, e As System.EventArgs) Handles ListView1.Click
    'Refernces the selected record
    Try
        If IsNothing(ListView1.SelectedItems) = False Then
            For Each sItem As ListViewItem In ListView1.SelectedItems
                If sItem.Subitem(3).Text.ToLower() = "fail" Then
                    MsgBox("Failing grade!")
                End If
            Next
        End If
    Catch ex As Exception
        MsgBox("There was a problem referencing the entry!" & vbCrLf & ex.Message)
    End Try
End Sub

Edited 4 Years Ago by Begginnerdev

This question has already been answered. Start a new discussion instead.