Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I perform multiple async calls to a ASP.Net webservice from .NET Winforms?
    primarykey
    data
    text
    <p>I would like to use my webservice but I can't seem to call multiple async functions... Other than cascading from one AsyncCompleted to start another??</p> <p>Imports picklists.MyWebService</p> <p>Public Class main</p> <pre><code>Dim WithEvents ws As New picklists.MyWebService.picklists Private Sub main_Load(sender As Object, e As EventArgs) Handles MyBase.Load ws.GetCustomersAsDatatableAsync() ws.GetRoutesAsDatatableAsync() End Sub Private Sub ws_GetCustomersAsDatatableCompleted(sender As Object, e As GetCustomersAsDatatableCompletedEventArgs) Handles ws.GetCustomersAsDatatableCompleted Dim dt As DataTable = CType(e.Result, DataTable) cmb_customer.DataSource = dt cmb_customer.DisplayMember = "NAME" End Sub Private Sub ws_GetRoutesAsDatatableCompleted(sender As Object, e As GetRoutesAsDatatableCompletedEventArgs) Handles ws.GetRoutesAsDatatableCompleted Dim dt As DataTable = CType(e.Result, DataTable) cmb_route.DataSource = dt cmb_route.DisplayMember = "NAME" End Sub </code></pre> <p>Innerexception: <strong>{"There was an error during asynchronous processing. Unique state object is required for multiple asynchronous simultaneous operations to be outstanding."}</strong></p> <p><strong>EDIT/SOLUTION</strong>:</p> <pre><code>Imports picklists.MyWebService Public Class main Dim WithEvents ws As New picklists.MyWebService.picklists Private Sub main_Load(sender As Object, e As EventArgs) Handles MyBase.Load ws.GetCustomersAsDatatableAsync(Guid.NewGuid.ToString) ws.GetRoutesAsDatatableAsync(Guid.NewGuid.ToString) End Sub Private Sub ws_GetCustomersAsDatatableCompleted(sender As Object, e As GetCustomersAsDatatableCompletedEventArgs) Handles ws.GetCustomersAsDatatableCompleted Dim g As String = e.UserState Dim dt As DataTable = CType(e.Result, DataTable) cmb_customer.DataSource = dt cmb_customer.DisplayMember = "NAME" End Sub Private Sub ws_GetRoutesAsDatatableCompleted(sender As Object, e As GetRoutesAsDatatableCompletedEventArgs) Handles ws.GetRoutesAsDatatableCompleted Dim g As String = e.UserState Dim dt As DataTable = CType(e.Result, DataTable) cmb_route.DataSource = dt cmb_route.DisplayMember = "NAME" End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload