Regarding the array list, try: (and this will be long-hand, there are
plenty of places to take short cuts, but I'm doing it long hand to
show you the steps)
object[] policies = ArrayListofPolicies.ToArray();
// hashed out - this might be ordered, not sure.
foreach( object o in policies ){
Policy p = (Policy)o;
string txt = p.Method1() + "\t";
txt += p.Method2();
txt += p.Method3();
txt += p.Method4();
Console.WriteLine( txt );
}
//or indexed in order:
for( int x=0; x<policies.Length; x++ ){
Policy p = (Policy)policies[x];
string txt = p.Method1();
// .......
Console.WriteLine( txt );
}
Again, this is sloppy long-hand, but I think you get the gist of it.
Also, if you wrote the Policy object and can change it, you might want
to expose the "pieces of information" as an array of values.
for( int x=0; x<policies.Length; x++ ){
Policy p = (Policy)policies[x];
string txt = "";
for( int y=0; y<p.Values.Length; y++ ){
txt += p.Values[x] + "\t";
}
Console.WriteLine( txt );
}
or with a class indexer:
for( int x=0; x<policies.Length; x++ ){
Policy p = (Policy)policies[x];
string txt = "";
for( int y=0; y<p.ValueCount; y++ ){
txt += p[x] + "\t";
}
Console.WriteLine( txt );
}
There are many options.
"Beza" <be**@beza.com> wrote in message news:<e0**************@TK2MSFTNGP11.phx.gbl>...
I have an ArrayList which stores x number of "Policy" objects, where x is
the number of rows returned from a earlier SQL query (therefore it is
changeable).
Each "Policy" has a few methods within it that returns values.
How do I display a row of information for each "Policy" (stored in the
ArrayList) in the browser?
Also, what is the best way of assigning values returned from object methods
to specfic fields in DataLists, DataGrids etc?