void PManagerListForm_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) //todo: check if user is admin of the company { try { DataBaseInterface.RemoveManager(DataSaver.UId, DataSaver.PasswordHash, (CompanyManager)XManagersList.SelectedItem); XManagersList.Items.Remove(XManagersList.SelectedItem); } catch { } } }