after i programming this code for fill text-box when combo-box selected Index changed
i got this error 'Object reference not set to an instance of an object.', whats can i do ??
Private Sub participant1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles participant1.SelectedIndexChanged
    Try
        Dim cmd As SqlCommand = New SqlCommand()
        Dim datareader As SqlDataReader = Nothing
        If Class1.sqlcon.State = ConnectionState.Open Then
            Class1.sqlcon.Close()
        End If
        Class1.sqlcon.Open()
        Dim query As String
        query = " select * from tparticipant where namea = '" & participant1.Text & "'"
        cmd = New SqlCommand(query, Class1.sqlcon)
        While datareader.Read
            If datareader IsNot Nothing Then
                ID.Text = datareader.GetInt32("ID")
                total.Text = datareader.GetInt32("total")
            End If
        End While
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try`
 
     
     
     
    