Hi,
I am using the following code
private void menuItemStart_C lick(object sender, System.EventArg s e)
{
DataTable tbRand, tbShow;
int randSize;
....
// schema of tbShow is being loaded from an xsd file
tbRand = DrawEngine.Gene rateAllDraws(tb Rand, randSize, ref tbShow);
dataGridRandomi zed.DataSource = tbShow;
....
}
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 GeneratingAllDr awsDelegate(Dat aTable table,
int tot, ref DataTable show);
private void menuItemStart_C lick(object sender, System.EventArg s e)
{
...
GeneratingAllDr awsDelegate dc = new
GeneratingAllDr awsDelegate(Dra wEngine.Generat eAllDraws);
AsyncCallback cb = new AsyncCallback(g etResultAllDraw s);
IAsyncResult ar = dc.BeginInvoke( tbRand, randSize, ref tbShow, cb,
null);
...
}
private void getResultAllDra ws(IAsyncResult ar)
{
DataTable tbRand, tbShow;
GeneratingAllDr awsDelegate del;
// schema of tbShow is being loaded from an xsd file
del = (GeneratingAllD rawsDelegate) ((AsyncResult)a r).AsyncDelegat e;
tbRand = del.EndInvoke(r ef tbShow, ar);
dataGridRandomi zed.DataSource = 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.
Thanks in Advance