Kevin Robinson
asked on
Loading Data Async
I am try to load some of my data asynchronously using the code below. But I am getting the error.
Cross-thread operation not valid: Control 'dg_Contacts' accessed from a thread other than the thread it was created on.
Cross-thread operation not valid: Control 'dg_Contacts' accessed from a thread other than the thread it was created on.
Private M_LoadContactAsync As WCF_Contacts.Contact.DelLoadContact
Public Sub LoadContactAsync()
M_LoadContactAsync = AddressOf Me.Contact.LoadContacts
M_LoadContactAsync.BeginInvoke(Me.M_OrgID, AddressOf CallBackLoadAddress, Nothing)
End Sub
Public Sub CallBackLoadAddress(ByVal r As IAsyncResult)
Me.Contacts = Me.M_LoadContactAsync.EndInvoke(r)
Me.dg_Contacts.DataSource = Me.Contacts
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.