Here is the question. I have a restaurant program in which customer chooses what he wishes to eat and that data is displayed in dataGridView. For example 6 different dishes = 6 different rows each containing Name, Amount and Price. After all I need to print a bill, so I want to get all information from dataGridView to a textbox. All rows. How I can do that?
P.S. I've searched a lot but there is only information on how to transfer CurrentRow data to a textbox that I've found.
private void Form4_Load(object sender, EventArgs e)
{
Form1 f1 = new Form1();
string billinfo = string.Empty;
foreach (DataGridViewRow row in f1.dataGridView1.Rows)
{
billinfo = string.Format("{0}{1} {2} {3}{4}", billinfo, row.Cells["Name"].Value, row.Cells["Amount"].Value, row.Cells["Price"].Value, Environment.NewLine);
}
textBox1.Text = billinfo;
}