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

sir thank you :) it works :)

No problem my friend. Just be sure to marked the thread as solved.

Thank you for chosing Daniweb. :)

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.