How to clone/duplicate a TableCell object

C

Chris Becker

I want to create a TableCell object once and add it to many tables:

Dim cell As New TableCell
cell.Style.Add("background-color", s)
cell.Style.Add("cursor", "pointer")
cell.Width = Unit.Pixel(CELLDIMENSION)
cell.Height = Unit.Pixel(CELLDIMENSION)
cell.HorizontalAlign = HorizontalAlign.Center
cell.Text = " "
cell.Attributes.Add("Title", s)
cell.Attributes.Add("onclick", "clk(this);")

Then I want to add that cell to TWO tables:

tblForegroundColors.Rows(tblForegroundColors.Rows.Count - 1).Cells.Add(cell)
tblBackgroundColors.Rows(tblBackgroundColors.Rows.Count - 1).Cells.Ad(cell)

The problem is, the cell is only added to the tblBackgroundColors table.
Some objects have a Clone() method that returns a duplicate object of the
current one. But TableCell does not.

How can I easily duplicate the cell object?

Thanks
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top