I created a tableLayoutPanel
and later wanted to put a Panel
in each cell of tableLayoutPanel
.
I made the following code and when compiling it works.
Panel[,] panels = new Panel[tableLayoutPanel1.RowCount+1, tableLayoutPanel1.ColumnCount+1];
for (int i = 1; i <= tableLayoutPanel1.RowCount; i++) {
columns = 0;
for (int j = 1; j <= tableLayoutPanel1.ColumnCount; j++) {
panels[i, j] = new Panel() {
BackColor = Color.AliceBlue,
Margin = new Padding(0),
};
tableLayoutPanel1.Controls.Add(panels[i, j], i - 1, j - 1);
columns++;
counter++;
}
rows++;
}
Controls.Add(tableLayoutPanel1);
Why do I stop being able to access Design when I have this code? The error that appears is as follows:
"The designer can not process the code at 445 (...) The code within the method 'InitializeComponent' is generated by the designer and should not be handled. Please remove any changes and try opening the designer again. "