Слайд 13
Вывод в файл
private void button3_Click(object sender, EventArgs e)
{ string fl,result;
fl
= Microsoft.VisualBasic.Interaction.InputBox("Введите имя файла");
writefl = File.CreateText(fl + ".txt");
result = string.Format("{0,12}{1,5}{2,8}{3,19}{4,7}", "Фамилия", "Пол",
"Возраст", "Специальность", "Курс");
writefl.WriteLine(result);
for (int k = 0; k < dataGridView1.Rows.Count - 1; k++)
{ result = string.Format("{0,12}{1,5}{2,8}{3,19}{4,7}",
dataGridView1.Rows[k].Cells[0].Value,
dataGridView1.Rows[k].Cells[1].Value,
dataGridView1.Rows[k].Cells[2].Value,
dataGridView1.Rows[k].Cells[3].Value,
dataGridView1.Rows[k].Cells[4].Value);
writefl.WriteLine(result); }
writefl.Close();
}