473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problem tablelayoutpanel c# windows application

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
2 11647
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alexander Bolotnov | last post by:
Hi guys, here is another freaky thing that kind of bugs a lot. Maybe someone has ideas to this. We have a sort of a "dynamic" interface builder that will take a control schema and place the...
0
by: Sudha Chennai | last post by:
I am using windows forms control TableLayoutPanel and C#, VS2005 I want to remove/delete the rows dynamically from TableLayoutPanel... i dont find any links guiding me this.... can u anyone...
2
by: steve | last post by:
Hi All I need to change the rowspan, columnspan properties of a control when they are within a TableLayoutPanel (VB.net 2005) At runtime the property is not available, but is at design time ...
3
by: steve | last post by:
Hi All I have textboxes within a TableLayoutpanel and I want to be able to position an independant control adjacent to a selected textbox This independent control allows selection of text to...
3
by: swartzbill2000 | last post by:
Hello, I have an array of Buttons down a column of a TableLayoutPanel. They all share a common click handler. In the handler, how can I determine the row of the TableLayoutPanel for the Button...
0
by: khurram.shakir | last post by:
I am developing an application, which uses .NET 2.0/WinForms and has a designer for screen layout designing. User has an option to design the layout of screen, and for that we developed our own...
0
by: Code Monkey | last post by:
I've got Windows Form which has a TableLayoutPanel on it. I'm dynamically adding Labels to the cells, binding their values from a DataTable. What I want to do, is if a certain value of the...
1
by: sdanda | last post by:
Hai,I am working on windows forms..In my form I have textbox and Tablelayoutpanel.The textbox is used to promt the user for how many textboxes u want to add to Tablelayout panel..If i enter this...
0
by: strattonn | last post by:
I have a TableLayoutPanel on a form and I would like to freeze the first row and column so they do not scroll off the screen. Just like Excel's Fixed Row/Column feature. I have a feeling the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.