This is a migrated thread and some comments may be shown as answers.

Threading problem

5 Answers 139 Views
GridView
This is a migrated thread and some comments may be shown as answers.
phuong nguyen
Top achievements
Rank 2
phuong nguyen asked on 23 May 2007, 08:42 PM
I am using the background worker class in VS 2005. The worker's job is to get the data from the server every so often and update the grid data. Everything works fine. However, when user interacts with the grid layout i.e resize columns, grouping column, an exception is thrown. I tried the same code with MS data grid and the problem does not occur. Here's the code snippet.

Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
                thdProcessing.RunWorkerAsync()
End Sub

    Private Sub thdProcessing_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles thdProcessing.DoWork
        While True
             thdProcessing.ReportProgress(0, mobjConnection.Conductor.GetAllTasks)
             Threading.Thread.Sleep(5000)
        End While
    End Sub

    Private Sub thdProcessing_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles thdProcessing.ProgressChanged
        Telerikgrid.DataSource = e.UserState
        DataGridView1.DataSource = e.UserState
    End Sub

Here's the call stack of the exception

"   at Telerik.WinControls.UI.GridHeaderRowElement.OnMouseUp(MouseEventArgs e)\r\n   at Telerik.WinControls.RadElement.OnCLREventsRise(RoutedEventArgs args)\r\n   at Telerik.WinControls.RadElement.OnBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   at Telerik.WinControls.RadItem.OnBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   at Telerik.WinControls.UI.GridRowElement.OnBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)\r\n   at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)\r\n   at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)\r\n   at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)\r\n   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n   at System.Windows.Forms.Control.WndProc(Message& m)\r\n   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)\r\n   at Telerik.WinControls.RadControl.WndProc(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.Run(ApplicationContext context)\r\n   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()\r\n   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()\r\n   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)\r\n   at CivilAutoManagerDeveloperEdition.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81\r\n   at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()"

5 Answers, 1 is accepted

Sort by
0
Dimitar Kapitanov
Telerik team
answered on 24 May 2007, 08:53 AM
Hello phuong nguyen,
The problem you have experienced is fixed and the fix will be available in SP2 when released. We have fixed numerous other threading issues as well.

Regards,
Dimitar Kapitanov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
PortVista
Top achievements
Rank 2
answered on 30 May 2007, 12:14 PM
Wow wish I would have known this was broken too -- I wasted a few days on this before I had to go back and use the MS grid for threads.
0
Dimitar Kapitanov
Telerik team
answered on 30 May 2007, 02:39 PM
Hello Jason Honingford,
As part of our commitment to increase dramatically the quality and the performance of our products towards the Q2 release, threading issues are addressed also. Apologies for the caused waste of time on the threading problems.

Best wishes,
Dimitar Kapitanov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
jamsheer
Top achievements
Rank 1
Veteran
answered on 14 Sep 2018, 11:15 AM

Hy 

    How could I call a form from a thread. I am using a thread in form of button, When I click that button I will get the datatable and call another form with parameter datatable

Thank you

Jamshi

0
Hristo
Telerik team
answered on 17 Sep 2018, 08:39 AM
Hi Jamsheer,

You should not have issues creating a thread and passing a DataTable object to a form instance, as long as you access that form and the controls in it in a thread-safe way. The following article in MSDN discusses this in details: https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls.

I hope this will help.

Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
phuong nguyen
Top achievements
Rank 2
Answers by
Dimitar Kapitanov
Telerik team
PortVista
Top achievements
Rank 2
jamsheer
Top achievements
Rank 1
Veteran
Hristo
Telerik team
Share this question
or