473,513 Members | 2,307 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A strange problem....

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];

}

--
Regards
Ginny

Sep 8 '06 #1
1 946
>From endXXX when u set the datasource, use datagrid.Invoke() or
datagrid.BeginInvoke() and set datasource inside function pointed by
delegate

Regards
Nirmal
Ginny wrote:
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];

}

--
Regards
Ginny
Sep 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2296
by: Rob Ristroph | last post by:
Hi, It's pretty unhelpful to post "I have a huge piece of code that crashes in strange places, what's the problem?" but that's basically my problem and I really am at my wit's end. The piece...
2
1949
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
25
3697
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
2
1766
by: TB | last post by:
I am seeing a very strange problem as follows... I have a loop where a fair amount of processing is going on and near the top of the loop I access a class that has only static helper functions...
1
3755
by: Sam Kong | last post by:
Hello! Recently I had a strange problem with Visual C# 2005 beta 1. When I ran(F5 key) a program, <#if DEBUG> statement was not working. It ran as RELEASE mode. So I had to manually define...
8
6674
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and...
11
2568
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating...
12
2249
by: StephQ | last post by:
I have a class Bounds with two constructors: class Bounds { private: list<SegmentupperLinearSpline; // Upper bound. list<SegmentlowerLinearSpline; // Lower bound. ....
8
5272
by: Dox33 | last post by:
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples....
5
2407
by: ioni | last post by:
Good day, fellows! I have a strange problem – at my site there is a flash strip, that loads data dynamically. It works fine (grabs data from the remote server and presents it), however in IE7...
0
7171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7545
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7539
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5692
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3240
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.