0
I created a tableLayoutPanel
and later wanted to put a Panel
in each cell of tableLayoutPanel
.
I made the following code and when I compile, 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 am I unable to access Design when I have this code? The error that appears is the following:
"The designer cannot process the code at line 445 (...) The code Within the method 'Initializecomponent' is generated by the designer and should not be Manually modified. Please remove any changes and Try Opening the designer Again."
Welcome to SOPT. @João, could [Edit] your question and clarify the part "I can no longer access Design", got confused. Thank you.
– David
I have already edited. I cannot see the "visual" part of the program. The Form1.Cs[Design file].
– João Lopes
@Joãolopes where did you put this code? Which method and in which file?
– Jéf Bueno
I put the code in Form1.Designer.Cs. Ok, I got it... Here’s the problem... I can’t put the code here
– João Lopes