private void loadDGV(DataGridView dgv)
{
// populate dgv
}
I have 20 datagrid views that I have to populate and the datagrids are named DGV1, DGv2, DGV3, ..., DGV20. I intended to use a for loop to build these Data grid view names
int NumberofDgv = 20;
for (int i = 0; i < NumberOfDgv; i++)
{
LoadDGV("DGV"+i)
}
How do I pass this string to the method that accepts a Datagrid view name?
I am trying to build the Data grid view name dynamically how do I convert the string "DGV"+i to the type DataGrid view name inorder to pass it as a method to LoadDGV method. I tried searching in this forum but didn't find anything relevant. Thanks in advance for you answers.
int NumberofDgv = 20;
for (int i = 0; i < NumberOfDgv; i++)
{
DataGridView dgv = new DataGridView();
dgv.Id = "DGV"+i.ToString();
LoadDGV(dgv);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.