Hi,
I am using the following code in C#,
private void menuItemStart_Click(object sender, System.EventArgs e)
{
DataTable tbRand, tbShow;
int randSize;
.=2E.
// schema of tbShow is being loaded from an xsd file
tbRand =3D DrawEngine.GenerateAllDraws(tb=ADRand, randSize, ref tbShow);
dataGridRandomized.DataSource =3D tbShow;
.=2E.
}
This code works ok, and data is being showed correctly in datagrid.
Now I am trying to convert it to asynchronous code as shown below.
public delegate DataTable GeneratingAllDrawsDelegate(Dat=ADaTable table,
int tot, ref DataTable show);
private void menuItemStart_Click(object sender, System.EventArgs e)
{
...
GeneratingAllDrawsDelegate dc =3D new
GeneratingAllDrawsDelegate(Dra=ADwEngine.GenerateAllDraws);
AsyncCallback cb =3D new AsyncCallback(getResultAllDraw=ADs);
IAsyncResult ar =3D dc.BeginInvoke(tbRand, randSize, ref tbShow, cb,
null);
...
}
private void getResultAllDraws(IAsyncResult ar)
{
DataTable tbRand, tbShow;
GeneratingAllDrawsDelegate del;
// schema of tbShow is being loaded from an xsd file
del =3D (GeneratingAllDrawsDelegate) ((AsyncResult)ar).AsyncDelegat=ADe;
tbRand =3D del.EndInvoke(ref tbShow, ar);
dataGridRandomized.DataSource =3D tbShow;
}
When I execute this code, no data is being shown in datagrid(when
passing tbRand as DataSource same behaviour was given). I also tried
to place the tbShow into a DataSet and write the data to an XML file,
but no file is being created. Also no exception is being rised.
Can someone help me figure my problem out.=20
Thanks in Advance