By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,210 Members | 1,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,210 IT Pros & Developers. It's quick & easy.

problem tablelayoutpanel c# windows application

P: n/a
Hi all

i am using vs2005 C# window application

i am trying to add the controls dynamically inside the
"tablelayoutpanel", i need to add row by row and each row i will have
to have 10 columns and each column i need to add one control

If i try to do this the control coming one under one and not
horizontaly, what is missing here,,,,

tlp = new TableLayoutPanel();
tlp.Location = new Point(1, 24);
this.Controls.Add(tlp);

tlp.Controls.Add(txt_Code1, controlIndex,0);

tlp.Controls.Add(txt_Code2, controlIndex,1);

the above is bringing the second control down to the first control and
not beside to first control

i even tried the tlp.ColumnCount=2;

still same problem

help me out to come out of this problem

thanks a lot

May 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,
your code seems fine. I tried the following code, which results in a
10x5 grid.

TableLayoutPanel tableLayoutPanel1 = new TableLayoutPanel();
tableLayoutPanel1.Dock = DockStyle.Fill;
this.Controls.Add(tableLayoutPanel1);
for (int row = 0; row < 5; row++)
{
for (int column = 0; column < 10; column++)
{
TextBox textBox = new TextBox();
textBox.Text = string.Format("TextBox({0}, {1}) ", column, row);
tableLayoutPanel1.Controls.Add(textBox, column, row);
}
}

Andrej

"Sudha Pune" <su***************@gmail.com> wrote in message
news:11********************@q12g2000cwa.googlegrou ps.com...
Hi all

i am using vs2005 C# window application

i am trying to add the controls dynamically inside the
"tablelayoutpanel", i need to add row by row and each row i will have
to have 10 columns and each column i need to add one control

If i try to do this the control coming one under one and not
horizontaly, what is missing here,,,,

tlp = new TableLayoutPanel();
tlp.Location = new Point(1, 24);
this.Controls.Add(tlp);

tlp.Controls.Add(txt_Code1, controlIndex,0);

tlp.Controls.Add(txt_Code2, controlIndex,1);

the above is bringing the second control down to the first control and
not beside to first control

i even tried the tlp.ColumnCount=2;

still same problem

help me out to come out of this problem

thanks a lot

May 11 '06 #2

P: n/a
Hi thanks

And DockStyle only was missing in my code and so now i handled that
also... thanx a lot...

May 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.