private void DeleteRecord() { using (new WaitCursor()) { Record clsRecord = new Record(); clsRecord.Record_ID = System.Convert.ToInt32((Grid.SelectedCells[0].Column.GetCellContent(Grid.SelectedItem) as TextBlock).Text); if (MessageBox.Show("Are you sure? Delete this record?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { SetData(clsRecord); Boolean bSucess = new Boolean(); bSucess = RecordData.Delete(clsRecord); if (bSucess == true) { GoBack_To_Grid(); } else { MessageBox.Show("Delete failed.", "Error"); } } } }