private void DeleteSelectedRow(object sender, ItemClickEventArgs e) { if (searchGridControl.GetFocusedRow() is Post post) { _dataConnection.DeletePost(post); RefreshData(); popupMenu1.HidePopup(); } }
private void DeleteButton_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure to delete this post?", "Confirm Delete", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { try { _dataConnection.DeletePost(_post); } catch (Exception exception) { Console.WriteLine(exception.Message); throw; } this.Close(); } }