datagridview newmailex

Joined
Feb 18, 2009
Messages
12
Programming Experience
1-3
hi, everyone

once again i need your help.

i am currently using outlook's newmailex event to get new emails. i then write the body to a database (tblMails) and trying to update a datagridview that is bound to that same database (tblMails).

the problem if when i put datagridview1.update in the newmailex event i get an exception saying that operation is invalid because the control i not in the same thread. thus im wondering how do i make it all work. as in, after writing to a database, simply update the bound datagridview.

thanks in advance :)
 
If your event handler is being invoked in a secondary thread then you'll need to use delegation to marshal a method call to the UI thread in order to access your controls.

Accessing Controls from Worker Threads
 

Latest posts

Back
Top