private void btn_del_contracts_Click(object sender, EventArgs e) { int focusRow = ContractView.FocusedRowHandle; string idRow = ""; idRow = ContractView.GetFocusedDataRow()["ID"].ToString(); DataSaver ds = new DataSaver(login_, password_); lb_status.Text = ds.DeleteContracts(idRow); ContractsFill(); try { if (focusRow != ContractView.RowCount - 1) ContractView.FocusedRowHandle = focusRow - 1; else ContractView.FocusedRowHandle = focusRow; } catch { } _connection.Close(); }