public void Load() { using (StreamReader reader = new StreamReader(path)) { string s; while ((s = reader.ReadLine()) != null) { string[] split = s.Split(' '); RoutingRecord record = new RoutingRecord(); record.SetParameters(split[0], split[1], split[2], Convert.ToInt32(split[3])); table.Add(record); } } }
private void DelRotingRecord_Click(object sender, EventArgs e) { try { DataGridViewRow row = dataGridView1.SelectedRows[0]; RoutingRecord record = new RoutingRecord(); record.SetParameters((string)row.Cells["dest"].Value, (string)row.Cells["mask"].Value, (string)row.Cells["gateway"].Value, Convert.ToInt32(row.Cells["metric"].Value)); router.DeleteRoutingRecord(record); dataGridView1.Rows.Remove(row); } catch (ArgumentOutOfRangeException) { MessageBox.Show("Выберите строку для удаления"); } }