Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
995
RecordActivated
posted

Hi I have the below code which runs when a data card is selected.

How do i stop it from running if the user clicked on the "Add New Record" datacard? Is there a TypeOf record i can refer to?

Private Sub XamDataPresenter1_RecordActivated(sender As Object, e As Infragistics.Windows.DataPresenter.Events.RecordActivatedEventArgs) Handles XamDataPresenter1.RecordActivated

If TypeOf e.Record Is FilterRecord Then
Exit Sub
End If


' Check to make sure the selected Record is a DataRecord
If TypeOf e.Record Is DataRecord Then

' Cast the record passed in as a DataRecord
Dim myRecord As DataRecord = CType(e.Record, DataRecord)

myclientname = myRecord.Cells(0).Value.ToString()
myclientid = myRecord.Cells(1).Value.ToString()

getclientprogramhistory()

End If

End Sub

  • 995
    Verified Answer
    posted

    The below does the job.

    If IsNothing(myRecord.Cells(0).Value) = False Then
    myclientname = myRecord.Cells(0).Value.ToString()
    myclientid = myRecord.Cells(1).Value.ToString()

    getclientprogramhistory()
    End If