473,668 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete Rows from a TableLayoutPane l

Hi,

I am trying to delete rows from a TableLayoutPane l at Runtime. I tried
editing the RowStyles collection but doesn't do what I want it to. I
have a table with 10 rows. I want to delete rows 2 to 10 at runtime,
keeping the first row unchanged.

Can this be done?

Thanks,
Avanti Ketkar

Jul 28 '06 #1
2 30817
Hi,

I was struggling with the same problem today.
In the first column of my TableLayoutPane l, I'm showing a checkbox.
When the user is checking it, a new row needs to be created.
When the user is unchecking it, the row containing the checkbox should be
removed.

Logically to remove a row in the TableLayoutPane l, I would think to do
something like this:
tableLayoutPane l.RowStyles.Rem oveAt(index);

But I found out this is not enough.
You need to clear the controls for that given row as well!
tableLayoutPane l.Controls.Remo veAt(...);
tableLayoutPane l.Controls.Remo veAt(...);

Once the controls in the Controls-collection are gone, the Event that
redraws your tableLayoutPane l doesn't draw them again.

Hopes this is working for you as well...

"avanti" wrote:
Hi,

I am trying to delete rows from a TableLayoutPane l at Runtime. I tried
editing the RowStyles collection but doesn't do what I want it to. I
have a table with 10 rows. I want to delete rows 2 to 10 at runtime,
keeping the first row unchanged.

Can this be done?

Thanks,
Avanti Ketkar

Aug 7 '06 #2
Ok the problem seems to be a little bit more complicated than I thought at
first sight.

Solution, what to do when removing a row:
- decrement tableLayoutPane l.RowCount
- remove rowstyle: tableLayoutPane l.RowStyles.Rem oveAt(...)
- remove corresponding controls of removed row in tabelLayoutPane l.Controls
- change RowCounter of controls that come after the removed row

Explanation of last action:
tableLayout.Get Row('control'), where 'control' is a control belonging to a
row that comes after the remove row, will give you his old rowIndex!
For that you need to set the new rowIndex for all controls belonging to a
row that's coming after a removed row.

My code:
for (int counter = controlsCounter ; counter <
ux_tlpCostCente rs.Controls.Cou nt; counter++)
{
ux_tlpCostCente rs.SetRow(ux_tl pCostCenters.Co ntrols[counter],
ux_tlpCostCente rs.GetRow(ux_tl pCostCenters.Co ntrols[counter]) - 1);
}

Over here the integer 'controlsCounte r' is the beginindex of the first
control in my tableLayoutPane l.Controls that needs a new RowIndex.

This should really help now ;-)

"avanti" wrote:
Hi,

I am trying to delete rows from a TableLayoutPane l at Runtime. I tried
editing the RowStyles collection but doesn't do what I want it to. I
have a table with 10 rows. I want to delete rows 2 to 10 at runtime,
keeping the first row unchanged.

Can this be done?

Thanks,
Avanti Ketkar

Aug 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1116
by: 1qa2ws | last post by:
Hi, Where can I find a control for VS .NET 2003 (C#) which works like TableLayoutPanel in VS 2005? What I need? I need a table view where in each cell I can put whatever I want (button, label, listbox, etc). TableLayoutPanel in 2005 works fine for me, but I need something in 2003 now... 1qa2ws
2
11668
by: Sudha Pune | last post by:
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,,,,
0
3258
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 post code snippet Thanks a lot
2
17562
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 Any ideas Regards
3
3075
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 that got clicked? Bill
0
1029
by: Desperate | last post by:
How how i determine all the TableLayoutPanel in me. is it any diffferent if the TableLayoutPanel are within containers?
0
1795
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 TableLayoutPanel does not support this natively. Is there a way to put a second TableLayoutPanel above the main panel with one row and have it scroll left and right as the main panel is scrolled. Sort of like subscribing one control to the others' scroll...
4
3632
by: Jeff | last post by:
Hello, I am trying to drag and drop a label control from one cell in a tablelayoutpanel to another (VB2005). There is no problem if both cells are visible, but i cannot get the tablelayoutpanel to scroll in any direction (autoscroll is on), when the cell i want to drag to is no currently visible and requires scrolling to get to see it. Any suggestions would be greatly appreciated.
0
1249
by: yoav.sagi | last post by:
hi, i am Inheriting from TableLayoutPane with a designer that inherits from ParentControlDesigner ..i would like to allow the user to resize the columns and rows ..All rows and columns SizeType = SizeType.Absolute How can i detect that the user is over a colum\rown border and allow him to resize as the real TableLayoutPanelDesigner is doing? .thanks in Advanced ...
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8797
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8583
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5681
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2791
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1786
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.