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
455
delete item based on selection
posted

hey everyone,

got a little problem. Let's say I have 2 docuents in my xamdatagrid and I only want to remove 1 of them. So I'll highlight it and click my delete button. the only problem is I dont konw which option will only select the highlighted record. i either delete both or niether. here's the code that I have so far.

   Private Sub  Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnDelete.Click

        If xamDocGrid.ActiveRecord Is Nothing Then

            MessageBox.Show("You must select a document to Delete", "No Active Document Warning", MessageBoxButton.OK, MessageBoxImage.Information)
         
        Else
            ' For Each row As DataRow In dtDocs.Rows
            ' If Not xamDocGrid.ActiveRecord Is Nothing Then
            xamDocGrid.Records.ElementAt()

            ' row.Item("Active") = False

            'End If

            'Next

            Try
                For Each row As DataRow In dtDocs.Rows

                    If row.Item("Active") = False Then
                        row.Delete()
                    End If

                Next
            Catch ex As Exception
                Return

            End Try
   

thanks in advance

Joel