Hello,
Yes it is possible, but should not be needed. It was needed in the COM version, since there was an open connection to the database. Making a smaller query to the database could speed up the fetch.
In .NET, the Spread is bound to a local DataSet/DataTable. Setting the DataSource to this connection would populate the Spread instantaneous. The creation of the DataSet/DataTable can still take some time, but this is not something virtualmode on the Spread can speed up.
To implement your own virtualmode in the Spread, you would need to handle the filling of the Spread control. You can use the TopChange and/of LeftChange events to do this. Here is an example of how to do this.
[code]
string[,] a = new string[100000,20];
FarPoint.Win.Spread.Model.CellRange virtualport;
private void Form1_Load(object sender, System.EventArgs e)
{
int i,j;
string s;
fpSpread1.Sheets[0].RowCount = 100000;
fpSpread1.Sheets[0].ColumnCount = 20;
for (i=0;i<100000;i++)
for (j=0;j<20;j++)
{
s = "Row:" + i.ToString() + ", Col:" + j.ToString();
a[i,j] = s;
}
virtualport = new FarPoint.Win.Spread.Model.CellRange(0,0,1000,10);
FarPoint.Win.Spread.Model.CellRange cr = virtualport;
FillSpread(cr);
}
private void button1_Click(object sender, System.EventArgs e)
{
fpSpread1.Sheets[0].SetArray(0,0,a);
}
private void button2_Click(object sender, System.EventArgs e)
{
}
private void FillSpread(FarPoint.Win.Spread.Model.CellRange cr)
{
int i,j;
for(i=cr.Row;i<cr.Row+cr.RowCount;i++)
for(j=cr.Column;j<cr.Column+cr.ColumnCount;j++)
fpSpread1.Sheets[0].SetValue(i,j,a[i,j]);
}
private void fpSpread1_TopChange(object sender, FarPoint.Win.Spread.TopChangeEventArgs e)
{
if (!((virtualport.Contains(fpSpread1.GetViewportBottomRow(0),fpSpread1.GetViewportRightColumn(0),1,1))))
{
virtualport = new FarPoint.Win.Spread.Model.CellRange(fpSpread1.GetViewportTopRow(0), fpSpread1.GetViewportLeftColumn(0), 1000,10);
if (virtualport.IntersectRow(fpSpread1.Sheets[0].RowCount))
virtualport = new FarPoint.Win.Spread.Model.CellRange(fpSpread1.Sheets[0].RowCount-1000, virtualport.Column, 1000,10);
FillSpread(virtualport);
}
}
private void fpSpread1_LeftChange(object sender, FarPoint.Win.Spread.LeftChangeEventArgs e)
{
if (!((virtualport.Contains(fpSpread1.GetViewportBottomRow(0),fpSpread1.GetViewportRightColumn(0),1,1))))
{
virtualport = new FarPoint.Win.Spread.Model.CellRange(fpSpread1.GetViewportTopRow(0), fpSpread1.GetViewportLeftColumn(0), 1000,10);
if (virtualport.IntersectColumn(fpSpread1.Sheets[0].ColumnCount))
virtualport = new FarPoint.Win.Spread.Model.CellRange(virtualport.Row, fpSpread1.Sheets[0].ColumnCount - 10, 1000,10);
FillSpread(virtualport);
}
}
}
[/code]
Scott S.
FarPoint Technologies, Inc.