A strange problem....

G

Ginny

Hi,
I have a simple web service that returns a dataset. Its very simple. i call
the web service from a windows app. it works abosolutely fine when i can the
web service method synchronously. but when i try to call the method
asynchronosuly using the 'beginxxx' and 'endxxxx' it does not give any error
but at the same time, the datagrid on the form does not show any data as
well. the only code in my windows form is menitoned below. Kindly if some
one can assist.


private void button1_Click(object sender, System.EventArgs e)
{
Asynch.Service1 obj = new Asynch.Service1();
AsyncCallback cb = new AsyncCallback(callback);
obj.BeginGetDataAll(cb,obj);
}

private void callback(IAsyncResult ar)
{
Asynch.Service1 obj = (Asynch.Service1)ar.AsyncState;
DataSet ds = obj.EndGetDataAll(ar); // I have tried type casting also
here but still does not work --- DataSet ds =
(DataSet)obj.EndGetDataAll(ar);
dataGrid1.DataSource = ds.Tables[0];

}
 
N

nirmal.c

From endXXX when u set the datasource, use datagrid.Invoke() or
datagrid.BeginInvoke() and set datasource inside function pointed by
delegate

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top