Hello:
In a routine I need to populate the TextBoxs in a Form. How do I assign a form that I only have the string of the Form name? Not sure how to explain this. If someone replys to this post, I can maybe explain it better if questions are asked.
Below is the code that I have started:
for (TheRow = 0; TheRow < FormICEPack.dataGridViewRecord.Rows.Count - 1; TheRow++)
{
TheColumnName = FormICEPack.dataGridViewRecord.Rows[TheRow].Cells["Column"].Value.ToString();
TheValue = FormICEPack.dataGridViewRecord.Rows[TheRow].Cells["TheValue"].Value.ToString();
MessageBox.Show("L-0617: TheRow=" + TheRow + " TheColumnName=" + TheColumnName + " TheValue=" + TheValue);
//Form_ID + ".textBox" + TheColumnName + ".Text" = TheValue;
//FormCompany.textBoxAddress_1.Text = TheValue;
}
How Do I: Setup the assignment of a form so I can change the textBox in it?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

PJ MartinsRank #2,548 · 548 reputationPosted May 26, 2010, 1:51 PM EDT
You'd most likely need something like this:
Form frm = (Form)Controls.Find("Form_ID", true);
TextBox txt = (TextBox)frm.Controls.Find("textBox" + The ColumnName, true);
txt.Text = TheValue;