473,387 Members | 1,572 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,387 software developers and data experts.

Equivalent of TableRow and TableCell class

Hi
I can use the TableRow and TableCell class in C# while using Web
forms. The same are not available while programming with Windows
Forms. I have the folloowing code that works fine with Web forms but
returns error with Windows Forms. How can I make it run for Windows
forms:

TableRow r;
TableCell c;

for (j=0; j < colCount; j++)
{
r= new TableRow();
c = new TableCell();
c.Controls.Add(new LiteralControl(DS.Tables[0].Columns[j].ColumnName));
c.VerticalAlign = VerticalAlign.Top;
c.Style["background-color"] = "lightblue";
r.Cells.Add(c);

for (i = 0; i {
c = new TableCell();
c.Controls.Add(new LiteralControl(dataArray[i][j]));
c.VerticalAlign = VerticalAlign.Top;
r.Cells.Add(c);
}

Table1.Rows.Add(r);
}

}
Nov 16 '05 #1
3 3299
Rajeev,

In windows forms commonly used grid is datagrid. To construct the grid,
DataTable, DataRow, DataColumn classes are used and finally assigned to
Datasource property for unbound grid.

If you want to construct a HTML table in Webbrowser component using
HTMLDocumentClass, there are bunch of classes like HTMLTableClass,
HTMLTableCellClass, HTMLTableRowClass is available to construct tables. To
get access to these classes you have to include "using mshtml" namespace,

--
Shak
(Houston)
"Rajeev" <na*****@yahoo.com> wrote in message
news:8f**************************@posting.google.c om...
Hi
I can use the TableRow and TableCell class in C# while using Web
forms. The same are not available while programming with Windows
Forms. I have the folloowing code that works fine with Web forms but
returns error with Windows Forms. How can I make it run for Windows
forms:

TableRow r;
TableCell c;

for (j=0; j < colCount; j++)
{
r= new TableRow();
c = new TableCell();
c.Controls.Add(new LiteralControl(DS.Tables[0].Columns[j].ColumnName));
c.VerticalAlign = VerticalAlign.Top;
c.Style["background-color"] = "lightblue";
r.Cells.Add(c);

for (i = 0; i {
c = new TableCell();
c.Controls.Add(new LiteralControl(dataArray[i][j]));
c.VerticalAlign = VerticalAlign.Top;
r.Cells.Add(c);
}

Table1.Rows.Add(r);
}

}

Nov 16 '05 #2
Thanks
Could you please convert the code I had listed so it can be used in
Windows Form application.

Thanks

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3
Hi
I am facing the same problem. I am using WindowsForms and would like
to know how to display columns as rows.

Thanks
John
Nov 16 '05 #4

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

Similar topics

2
by: thomasamillergoogle | last post by:
Hi, As you can see from the code below I have a simple js function called getFormElementsinTableRow(rowName). rowName is the ID of the tableRow. I just want to use js to find the child ID's of all...
0
by: Randy | last post by:
Hello All, Is there any way to make this happen... Say I want to make a table with 3 rows. The first row has two TableCells each with a width of 300. The second row has one TableCell with the...
2
by: George Durzi | last post by:
Consider this pseudo HTML from a web form <asp:Table> <asp:TableRow> <asp:TableCell> <asp:Table> <asp:TableRow> <asp:TableCell></asp:TableCell> <asp:TableCell></asp:TableCell>...
2
by: Coleen | last post by:
Hi all :-) I have the following code, and need it to break specifically at a point in the span, but I am unable to get it to break exactly where I want it to. <asp:TableCell CssClass="table"...
3
by: RobertH | last post by:
Hello all. I have been hacking away trying to get a SQL image (jpeg) to render in a control or table row Without using the Response.BinaryWrite.... I think i might be on the verge but need a...
6
by: hb | last post by:
Hi, I have a page bill.aspx and its code-behind bill.aspx.cs. On bill.aspx I have: === Select a month: <asp:dropdownlist runat="server" id="lstDate" autopostback="True" /> <br> <asp:table...
3
by: Alex Maghen | last post by:
Okay, I'm sure that this is an incredibly simple one and it may have more to do with HTML than with ASP.NET I have an ASP:Table with no borders and that table has several ASP:TableRows, each with...
1
by: Harry | last post by:
Dear All, I would like to know whether it is possible to add a table in tablerow? Dim Table1 As New Table. Dim Row1 As New TableRow Dim Table2 As New Table Row1.Cells.Add(Table2) ...
22
by: Alan Silver | last post by:
Hello, I am updating some old web pages, and have come across a problem. I have some tables where the opening tag looks like... <table border="1" bordercolor="#ffffff"> which gives a nice...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...

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.