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 CreateDataSourc eCallBack()
Private ThreadListen As New Thread(AddressO f ListenServerThr ead)
Private ThreadTableUpda te As New Thread(AddressO f CreateDataSourc e)
*** wrapped in a try ***
If Me.DGV1.InvokeR equired = True Then
Dim invoke_createda tasource As New CreateDataSourc eCallBack(Addre ssOf
CreateDataSourc e)
Me.Invoke(invok e_createdatasou rce)
Else
Me.DGV1.Rows.Cl ear()
update grid here.......
I reset the thread to update the table as listed below:
If ThreadTableUpda te.ThreadState = ThreadState.Sto pped Then
Me.ThreadTableU pdate = New Thread(New ThreadStart(Add ressOf
Me.CreateDataSo urce))
Me.ThreadTableU pdate.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 CreateDataSourc eCallBack()
Private ThreadListen As New Thread(AddressO f ListenServerThr ead)
Private ThreadTableUpda te As New Thread(AddressO f CreateDataSourc e)
*** wrapped in a try ***
If Me.DGV1.InvokeR equired = True Then
Dim invoke_createda tasource As New CreateDataSourc eCallBack(Addre ssOf
CreateDataSourc e)
Me.Invoke(invok e_createdatasou rce)
Else
Me.DGV1.Rows.Cl ear()
update grid here.......
I reset the thread to update the table as listed below:
If ThreadTableUpda te.ThreadState = ThreadState.Sto pped Then
Me.ThreadTableU pdate = New Thread(New ThreadStart(Add ressOf
Me.CreateDataSo urce))
Me.ThreadTableU pdate.Start()
End If
Comment