I have 3 objects in my VB .NET project: 1. DeltaTau wrapped COM object (talking to a PMAC controller over USB) Updates GUI textbox controls with current process status info
2. Vision native .NET object (controlling a vision process over Matrox Mil 7.5) displays a continuous live camera image 3. MainForm .NET form with several wrapped COM objects talking to a DDE Server. Contains a tab control with separate tabs for Vision and DeltaTau The DeltaTau object controls an insertion process that needs monitoring. When complete or on error various bits are set that indicate status. Concurrent with this monitoring the Vision system is acquiring images from a camera system and displaying them on the screen. I started using a System.Timers.Timer for best resolution in my process monitoring in the DeltaTau object. However when I have the System.Timers.Timer enabled my vision object locks up the UI Form. I asked some of the .NET folks around here and was told I need to use BeginInvoke on any function that needs to update the GUI since System.Timers.Timer operates in it's own thread space. Private Sub myDatatimer_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Dim ActualPosition, CurrentForce, EndingForce, EndingPosition, PeakForce As Single Try ' Live Data ActualPosition = PTalkDT2.DPRGetFloat(GCACTUAL_POSITION_OFFSET) CurrentForce = PTalkDT2.DPRGetFloat(GCFEEDBACK_FORCE_OFFSET) EndingForce = PTalkDT2.DPRGetFloat (GCFORCE_INSERTION_COMPLETE_OFFSET) EndingPosition = PTalkDT2.DPRGetFloat (GCPOSITION_INSERTION_COMPLETE_OFFSET) PeakForce = PTalkDT2.DPRGetFloat(GCPEAK_FORCE_OFFSET) RaiseEvent LiveData(ActualPosition, CurrentForce, EndingForce, EndingPosition, PeakForce) Catch ex As Exception RaiseEvent PMACDPRamReadFailed() Exit Sub End Try End Sub ' Live Data Private Sub DeltaTau2_LiveData(ByVal ActualPosition As Single, ByVal CurrentForce As Single, ByVal EndingForce As Single, ByVal EndingPosition As Single, ByVal PeakForce As Single) Handles DeltaTau2.LiveData BeginInvoke(New DeltaTau1.__Delegate_LiveData(AddressOf LiveData), New Object() {ActualPosition, CurrentForce, EndingForce, EndingPosition, PeakForce}) End Sub Private Sub LiveData(ByVal ActualPosition As Single, ByVal CurrentForce As Single, ByVal EndingForce As Single, ByVal EndingPosition As Single, ByVal PeakForce As Single) ' ensure exclusive access to data SyncLock txtActualPosition.Text txtActualPosition.Text = ActualPosition txtCurrentForce.Text = CurrentForce txtEndForce.Text = EndingForce txtEndPosition.Text = EndingPosition txtPeakForce.Text = PeakForce End SyncLock End Sub However this does not seem to clear up the GUI lock up problem. Any ideas? Thank you, Grant =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com