private void btChangeAddresses_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count != 2) { MessageBox.Show("Выберите две строки"); return; } RP r1 = rp(dataGridView1.SelectedRows[0].Index); RP r2 = rp(dataGridView1.SelectedRows[1].Index); string ca = r1.CurAddress; r1.SetCurAddress(r2.CurAddress, true); r2.SetCurAddress(ca, true); this.update(); }