A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

BackGroundWorker.ProgressChanged "Cross-thread operation not valid" at 2nd/3th/... progress



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old February 13th 06, 01:09 PM posted to microsoft.public.dotnet.framework,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb,microsoft.public.outlook.program_vba
Pieter
external usenet poster
 
Posts: 27
Default BackGroundWorker.ProgressChanged "Cross-thread operation not valid" at 2nd/3th/... progress

Hi,

I've tryed it, but it didn't work either :-/
And isn't the BackGroundWorker designed so we shouldn't worry anymore about
those Invoke and Delegates-stuff?

This is my new code with Invoke, which doesn't work either... :-/

Private Sub bgwInfoOutlook_ProgressChanged(ByVal sender As Object, ByVal
e As System.ComponentModel.ProgressChangedEventArgs) Handles
bgwInfoOutlook.ProgressChanged
Try
SetDataSource()
Catch ex As Exception
ErrorMessage(ex)
End Try
End Sub

Delegate Sub SetDgvCallback()

Private Sub SetDataSource()
If Me.dgvAdd.InvokeRequired Then
Dim d As New SetDgvCallback(AddressOf SetDataSource)
Me.Invoke(d, Nothing)
Else
Me.dgvAdd.DataSource = Nothing
Me.dgvAdd.DataSource = docCtrl.InfoList
End If
End Sub

And the werit thing is: the Me.dgvAdd.InvokeRequired returns False...

"Dmytro Lapshyn [MVP]" wrote in message
...
Hi Pieter,

As far as I know, .NET 2.0 strictly prohibits any access to the user
interface from background worker threads. This wasn't allowed in .NET 1.1
either, but in that version one sometimes could get away with violating
the rule. Now you'll get the "Cross-thread operation not valid" almost for
sure.

Therefore, to do any updates to the UI properly, you should use the
Control.Invoke method to run the UI update code on the UI thread.



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2002 "The operation Failed" when clicking Send/Receive Douglas Hay Outlook - General Queries 2 March 6th 06 04:34 PM
How Do I Set Free/Busy to show "no information" cross hatches? zrated2 Outlook - Calandaring 1 February 10th 06 09:02 PM
Outlook.ApplicationClass.CreateItem: "The operation failed." Bruce Wood Outlook and VBA 2 February 1st 06 01:12 AM
can't send/receive in OL2003. "operation failed. object missing" sk Outlook - Installation 0 January 26th 06 01:40 PM
Why is "FAX" a valid e-mail type in address book? Opus Outlook - Using Contacts 3 January 13th 06 08:24 PM


All times are GMT +1. The time now is 05:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.