Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / August 2004

Tip: Looking for answers? Try searching our database.

Can't Bind Datagrid with Dataset returned by WebService

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
QuocSI - 12 Aug 2004 09:48 GMT
Hi all,

I've wrote a Webservice which return a Dataset.

I have made an object on a client pc to acces this webservice.
The asynchhroned call to webservice fill correctly my dataset.

But when in my form, I wish to use this Dataset, I get error at runtime.

Datagrid1.datasource = MyObject.MyDataset

Do not provide error on compilation.

With an asynchroned call, does the system create a secondary thread.
The dataset seem not to be part of the principal thread.
So how can I bind then returned datas.

Thanks a lot for your help.
Trebek - 12 Aug 2004 12:09 GMT
It is possible that the callback is not on the Message pump thread.  I would
suggest that you check and see by calling InvokeRequired.  If so, simply
define a delegate and method that implements this delegate to bind the
datagrid and invoke it from the web service async callback.

EX in C#  (Sorry -- never messed with VB):

   //Delegate definition
   public delegate void DelBindMyGrid(DataSet ds);

   //In async callback
   DataSet ds = ws.EndMethod(ir);
   this.Invoke(new DelBindMyGrid(BindGrid),new object[]{ds});

   //Delegate method to bind grid -- called thru invoke to run under msg
pump thread
   private void BindGrid(DataSet ds)
   {
       Datagrid1.datasource = MyObject.MyDataset;
   }

HTH,

Alex

> Hi all,
>
[quoted text clipped - 14 lines]
>
> Thanks a lot for your help.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.