0

Gidday I have a single Array of items (total number of items in array would be variable) that i want to display in a table like format i.e.

<table>
<tr>
<td>ArrayVar[0]</td>
<td>ArrayVar[1]</</td>
</tr>
<tr>
<td>ArrayVar[2]</</td>
<td>ArrayVar[3]</</td>

etc...
or

<div style="float:left">ArrayVar[0]</div>
<div style="float:left">ArrayVar[1]</div>

etc...
How can I generate this in VB.net with say a loop I know there was something in .NET 1.1 that could do this & can't find anything for 2.0

3
Contributors
2
Replies
4
Views
10 Years
Discussion Span
Last Post by f1 fan
0

use a string builder if you want to make it yourself.

stringbuilder sb = new stringbuilder;
sb.appendline("<table>");
for (int i=0; i<=arraycount; i+=2) //for vb people it is For I = 0 to arraycount Step 2)
{
sb.appendline("<tr>");
sb.append("<td>");
sb.append(arrayvar[i]);
sb.appendline("</td>");
sb.append("<td>");
sb.append(arrayvar[i+1]);
sb.appendline("</td>");
sb.appendline("</tr>");
}
sb.appendline("</table>");
//now put it on the page - probably using a literal
literal1.text = sb.tostring();

or you could use an html writer but this works just as well.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.