private void buttonRemove_Click(object sender, EventArgs e) { if (dataGridViewPosts.SelectedRows.Count > 0) { int id = int.Parse(dataGridViewPosts.SelectedRows[0].Cells[0].Value.ToString()); var directoryPost = _qt.GetDirectoryPost(id); if (IsValidateRemove(directoryPost)) { _qt.RemoveDirectoryPost(directoryPost); _qt.Save(); AddRows(); } } }