Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

Bug in TableLayoutPanel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Timothy V - 27 Feb 2006 05:17 GMT
Hi all,
I don't usually post possible bugs because I would assume that there are
none. However, some of the properties are not acting acting as they should.

Here is what I have found. When using the AutoSize property set to "true",
and the GrowStyle property set to "AddColumns" or "AddRows" (default). You
add a control (such as a button) with:
this.tableLayoutPanel1.Controls.Add(new Button());

What this does is add the button to newly made cell (a cell in a new row if
"GrowStyle=AddRows" OR in a new column if "GrowStyle=AddColumns").

Lets add about 5 of these buttons. When we call:
this.tableLayoutPanel1.ColumnStyles.Count;
we should get an int that has 5 in it, right? Wrong. It is 0 (zero).

Am I using this wrong? Because strange enough, the controls are showing up
when I run the application.

I would be very interested in some comments on this.

Thanks all,
Tim.
CAnderson [MVP] - 01 Mar 2006 22:36 GMT
Are you looking to get the number of columns? Or the number of
columnStyles... which is what you are getting. Concidering that no
columnStyles have been added, only columns, I would expect ColumnStyles.Count
to return 0.

-CA

> Hi all,
> I don't usually post possible bugs because I would assume that there are
[quoted text clipped - 19 lines]
> Thanks all,
> Tim.
Timothy V - 02 Mar 2006 04:14 GMT
Thanks for your response... Your explaination sounds pretty much on the
ball. I have changed my column adding code to:
int i = tablelayoutpanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent,
50.0F));
tlp.Controls.Add(c, i, 0);

This now works fine with ColumnStyles.Count, giving the correct answer.
HOWEVER, I can't seem to get ColumnStyles.RemoveAt() to work.

From what you said previously, and from my understanding now, it is removing
the ColumnStyle, not the Column. How do I remove a column?

Thanks in advance,
Tim.

> Are you looking to get the number of columns? Or the number of
> columnStyles... which is what you are getting. Concidering that no
[quoted text clipped - 32 lines]
>> Thanks all,
>> Tim.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.