Cross-thread operation not valid


Author
Message
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi JSW,

 

We appreciate your king word and recommendations

You should also go with Nevron Chart for .NET – the charting control features unmatched set of features and has numerous advantages compared to solutions from other vendors. For more details contact Nevron Sales

 

Kind regards,

Nevron Support Team

Best Regards,
Nevron Support Team


JSW W.
JSW W.
Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)
Group: Forum Members
Posts: 127, Visits: 1

Thanks Angel for your help. We have a large project so it hard to find the problem, you have managed to resolve it!!! I almost gave up there.

Well, I am new to Nevron and I am customers to ComponentOne, Dundas, Telerik, and now Nevron.

My honest opinion was that Telerik service was good but Nevron personal service is off the chart!!!

Recommend to anyone

 


Martin Oosthuizen
Martin Oosthuizen
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)
Group: Forum Members
Posts: 2, Visits: 1
Hi Angel, thanks very much for the response.
The CheckForIllegalCrossThreadCalls setting does fix the problem, although I agree, the better solution would be to make the call thread-safe.
But just to let everyone know, that did the trick for me.
Angel Chorbadzhiev
Angel Chorbadzhiev
Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)
Group: Forum Members
Posts: 139, Visits: 184

Hi Martin and JSW W.,

I guess you are creating the documents in a separate thread.

If so, please, try to check whether invoke is required when you are creating it, because the UI suite is not thread safe.

You can create the document by the following way:

private void CreateUIDoc()

{

    if (InvokeRequired)

    {

        Invoke(new MethodInvoker(CreateUIDoc));

        return;

    }

    ctlWatchList m_ctlWatchList = new ctlWatchList(this) { Dock = DockStyle.Fill };

    NUIDocument docWatchList = new NUIDocument(WatchListTitle, -1, m_ctlWatchList);

    m_DockManager.DocumentManager.AddDocument(docWatchList);

}

Other option that you can try is to switch off the cross thread check by setting Control.CheckForIllegalCrossThreadCalls to false.

However, the first approach is recommended.

Please, let us know if you still have this problem.

Regards,

Angel Chorbadzhiev.


JSW W.
JSW W.
Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)
Group: Forum Members
Posts: 127, Visits: 1

I have encounter the same problem upgrading from version Q12007 UI to Q1 2010.

My error occurs when using thread.sleep()

 


Martin Oosthuizen
Martin Oosthuizen
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)
Group: Forum Members
Posts: 2, Visits: 1
Hi there.
I was using the Q1 2007 release until now, but am attempting an upgrade to the latest (2010) version. After redoing the references the program compiled without any big problems. But now, when the software runs, and I drag any tab(document) into another docking position it complains:

System.InvalidOperationException was unhandled
Message="Cross-thread operation not valid: Control '' 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.get_InternalHandle()
at System.Windows.Forms.Control.DestroyHandle()
at System.Windows.Forms.Control.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at Nevron.UI.WinForm.Controls.NUIDocument.PerformDispose()
at Nevron.UI.NDisposableObject.Dispose(Boolean disposing)
at Nevron.UI.NDisposableObject.Finalize()
InnerException:

The tabs are created like this (ctlWatchList is a user control with a datagrid):
ctlWatchList m_ctlWatchList = new ctlWatchList(this) { Dock = DockStyle.Fill };
NUIDocument docWatchList = new NUIDocument(WatchListTitle, -1, m_ctlWatchList);
m_DockManager.DocumentManager.AddDocument(docWatchList);


Do you have any ideas about what the problem could be?
What other information will you need from me?

I'd really appreciate the help.

Kind regards,
Martin

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search