Hi there,

I've a listobject that I've bound to an array of objects, each class of the object has about 7 members. When this array has about 1000 elements (1000 rows in the listobject) it takes over 10 seconds to fill it and display it. This array is created from a webservice call so it'll take about 5+ seconds to retrieve the data so another 10 to get it on the screen is far too long a time.

I used this technique below to see if manual 'painting' of the cells would be any quicker,

for (int i = 0; i < ds.Length; i++)

{

(Application.get_Range((Excel.Range)this.Cells[i + 1, 1],

(Excel.Range)this.Cells[i + 1, 7])).Value2 =

new object[7] {ds[ i].company, ds[ i].station, ds[ i].unit, ds[ i].fuel, ds[ i].NPR,

ds[ i].effectiveDate, ds[ i].status }

}

however, it was not. This method also took about 10 seconds.

If I take the data in chunks, lets say in 2's like this,

for (int i = 0; i < ds.Length; i+=2)

{

(Application.get_Range((Excel.Range)this.Cells[i + 1, 1],

(Excel.Range)this.Cells[i + 2, 7])).Value2 =

new object[2, 7] { {ds[ i].company, ds[ i].station, ds[ i].unit, ds[ i].fuel, ds[ i].NPR,

ds[ i].effectiveDate, ds[ i].status },

{ds[i+1].company, ds[i+1].station, ds[i+1].unit, ds[i+1].fuel, ds[i+1].NPR,

ds[i+1].effectiveDate, ds[i+1].status }};

}

it is twice as fast. If I do it in 5's, it's five times as fast.

So it would seem I'll have to manually paint it using an algorithm that 'paints' the data in 5's, then 2's, then 1's if appropriate. After which I'll add a listobject programmatically to surround the data.

Before I start this, can anyone tell me why the listobject is so slow? Is there anything I can do to speed it up? I would have thought it would have been optimised but it doesn't seem like it.

Thanks in advance for the advice.