T
Tlink
I have a master control program that needs to run continuously, accepting
data and updating a datagrid for the user. As a result I have setup 2
threads, one accepts and processes incoming requests and updates the
database, whilst the other thread is started once a update has been
committed to the database. The problem is when the datagrid is accessed
after the first time it is unable to access the datagrid (Cannot clear this
list)?
I have delegated the threads and also checked and invoked the thread as
below: The listenthread functions without issue as it never stops running,
whilst the tableupdate thread terminates when no vieweable data alters. Any
help or guidance would be greatly appreciated.
Delegate Sub CreateDataSourceCallBack()
Private ThreadListen As New Thread(AddressOf ListenServerThread)
Private ThreadTableUpdate As New Thread(AddressOf CreateDataSource)
*** wrapped in a try ***
If Me.DGV1.InvokeRequired = True Then
Dim invoke_createdatasource As New CreateDataSourceCallBack(AddressOf
CreateDataSource)
Me.Invoke(invoke_createdatasource)
Else
Me.DGV1.Rows.Clear()
update grid here.......
I reset the thread to update the table as listed below:
If ThreadTableUpdate.ThreadState = ThreadState.Stopped Then
Me.ThreadTableUpdate = New Thread(New ThreadStart(AddressOf
Me.CreateDataSource))
Me.ThreadTableUpdate.Start()
End If
data and updating a datagrid for the user. As a result I have setup 2
threads, one accepts and processes incoming requests and updates the
database, whilst the other thread is started once a update has been
committed to the database. The problem is when the datagrid is accessed
after the first time it is unable to access the datagrid (Cannot clear this
list)?
I have delegated the threads and also checked and invoked the thread as
below: The listenthread functions without issue as it never stops running,
whilst the tableupdate thread terminates when no vieweable data alters. Any
help or guidance would be greatly appreciated.
Delegate Sub CreateDataSourceCallBack()
Private ThreadListen As New Thread(AddressOf ListenServerThread)
Private ThreadTableUpdate As New Thread(AddressOf CreateDataSource)
*** wrapped in a try ***
If Me.DGV1.InvokeRequired = True Then
Dim invoke_createdatasource As New CreateDataSourceCallBack(AddressOf
CreateDataSource)
Me.Invoke(invoke_createdatasource)
Else
Me.DGV1.Rows.Clear()
update grid here.......
I reset the thread to update the table as listed below:
If ThreadTableUpdate.ThreadState = ThreadState.Stopped Then
Me.ThreadTableUpdate = New Thread(New ThreadStart(AddressOf
Me.CreateDataSource))
Me.ThreadTableUpdate.Start()
End If