I am creating dynamic textboxes on a form with a button(Form1,Panel1).I am sending the text from these dynamics to Excel (with a button from Form2), each textbox on a new row. If I start with a default spreadsheet with an unlimited amount of rows it will send the text just fine with a "foreach" loop. If I try to do an insert row for each textbox, the rows will insert but only the last textbox will show the data in a cell. IE: with 5 textboxes, the text from #5 will show. Here is the code I am using:
int row = 1;
foreach (TextBox dynamicTxtBx in sourcePanel.Controls.OfType<TextBox>())
{
worksheet.Rows[1].Insert();
worksheet.Cells[row++, "A"].value = dynamicTxtBx.Text;
// ...
}