private void biRemove_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int[] handles = this.gridView1.GetSelectedRows(); if (handles == null || handles.Length == 0) { XtraMessageBox.Show("No account selected"); return; } if (XtraMessageBox.Show("Do you really want to remove selected accounts?", "Removing Accounts...", MessageBoxButtons.YesNoCancel) != DialogResult.Yes) { return; } for (int i = 0; i < handles.Length; i++) { AccountInfo info = (AccountInfo)this.gridView1.GetRow(handles[i]); if (info.Exchange != null) { Exchange ee = info.Exchange; info.Exchange = null; Keys.Remove(info); ee.OnAccountRemoved(info); } } }