Click here to Skip to main content
15,929,833 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Avoid inserting a duplicate record using vb.net Pin
Luc Pattyn19-May-10 2:19
sitebuilderLuc Pattyn19-May-10 2:19 
GeneralRe: Avoid inserting a duplicate record using vb.net Pin
Johan Hakkesteegt19-May-10 2:45
Johan Hakkesteegt19-May-10 2:45 
AnswerRe: Avoid inserting a duplicate record using vb.net Pin
TheComputerMan19-May-10 6:06
TheComputerMan19-May-10 6:06 
Questionhow to check for duplication before inserting data in tables using vb.net Pin
faisalali_7818-May-10 21:13
faisalali_7818-May-10 21:13 
AnswerRe: how to check for duplication before inserting data in tables using vb.net Pin
Eduard Keilholz18-May-10 21:49
Eduard Keilholz18-May-10 21:49 
Questionhow to add controls dynamically ? [modified] Pin
sanyexian18-May-10 16:33
sanyexian18-May-10 16:33 
AnswerRe: how to add controls dynamically ? Pin
Luc Pattyn18-May-10 16:39
sitebuilderLuc Pattyn18-May-10 16:39 
QuestionCurious Cross Thread Error Pin
TheComputerMan18-May-10 4:31
TheComputerMan18-May-10 4:31 
Maybe it is not so curious, but it is to me at least.

I have a system.timers.timer declared and set up and then the code executes the final line in the routine is ProcessDuplicateMessage.

In the ProcessDuplicateMessage routine I get this error:

System.InvalidOperationException was unhandled by user code
Message="Cross-thread operation not valid: Control 'lblReviewValue' accessed from a thread other than the thread it was created on."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.set_WindowText(String value)
at System.Windows.Forms.Control.set_Text(String value)
at System.Windows.Forms.Label.set_Text(String value)
at ....FImportMsgProcess.ProcessDuplicateMessage() in C:\....\FImportMsgProcess.vb:line 41
at ....FImportMsgProcess.FormLoadComplete(Object sender, ElapsedEventArgs e) in C:\....\FImportMsgProcess.vb:line 134
at System.Timers.Timer.MyTimerCallback(Object state)

Now obviously this is something to do with the timer, which I assume is running in a different thread, but my question is:

How do I return the process to the thread for the form before calling the next routine.

If I remove the system.timers.timer and add a forms.timer I don't get the problem.

Just curious really since I have cured the immediate problem by using a forms.timer instead and I would like to know for another occasion. Smile | :)
AnswerRe: Curious Cross Thread Error Pin
Dave Kreskowiak18-May-10 5:05
mveDave Kreskowiak18-May-10 5:05 
GeneralRe: Curious Cross Thread Error Pin
Luc Pattyn18-May-10 5:09
sitebuilderLuc Pattyn18-May-10 5:09 
GeneralRe: Curious Cross Thread Error Pin
Dave Kreskowiak18-May-10 8:17
mveDave Kreskowiak18-May-10 8:17 
GeneralRe: Curious Cross Thread Error Pin
Luc Pattyn18-May-10 8:42
sitebuilderLuc Pattyn18-May-10 8:42 
GeneralRe: Curious Cross Thread Error Pin
TheComputerMan18-May-10 14:37
TheComputerMan18-May-10 14:37 
GeneralRe: Curious Cross Thread Error Pin
Luc Pattyn18-May-10 15:38
sitebuilderLuc Pattyn18-May-10 15:38 
QuestionNamespace importing at project level question Pin
programmervb.netc++17-May-10 8:20
programmervb.netc++17-May-10 8:20 
AnswerRe: Namespace importing at project level question Pin
Luc Pattyn17-May-10 8:29
sitebuilderLuc Pattyn17-May-10 8:29 
GeneralRe: Namespace importing at project level question Pin
programmervb.netc++17-May-10 8:45
programmervb.netc++17-May-10 8:45 
GeneralRe: Namespace importing at project level question Pin
Luc Pattyn17-May-10 8:49
sitebuilderLuc Pattyn17-May-10 8:49 
GeneralRe: Namespace importing at project level question Pin
programmervb.netc++17-May-10 9:02
programmervb.netc++17-May-10 9:02 
GeneralRe: Namespace importing at project level question Pin
Luc Pattyn17-May-10 9:06
sitebuilderLuc Pattyn17-May-10 9:06 
AnswerRe: Namespace importing at project level question Pin
Gideon Engelberth19-May-10 9:42
Gideon Engelberth19-May-10 9:42 
QuestionConcurrency Error Pin
Ghost_80717-May-10 5:48
Ghost_80717-May-10 5:48 
QuestionError Reading Raw Pixel Data Into Bitmap Pin
Sonhospa16-May-10 21:44
Sonhospa16-May-10 21:44 
AnswerRe: Error Reading Raw Pixel Data Into Bitmap Pin
Henry Minute17-May-10 1:39
Henry Minute17-May-10 1:39 
GeneralRe: Error Reading Raw Pixel Data Into Bitmap Pin
Sonhospa17-May-10 5:09
Sonhospa17-May-10 5:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.