private void SaveToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { File.WriteAllLines(saveFileDialog.FileName, tree.GetWays()); } catch (Exception) { MessageBox.Show("ошибка записи", "Error"); } } }