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

Stumaca,

www.asp.net

Check out their tutorials, I'm sure you'll be able to figure it out from there. Their tutorials are excellent for someone starting with ASP.

Jon

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.