Home All Groups Group Topic Archive Search About
Author
29 May 2006 3:04 PM
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

Author
29 May 2006 6:03 PM
Cor Ligthert [MVP]
Tlink,


It looks if you try to create a connected application using a Dataset.  If
you are updatating the datasource of you cannot in the same time refill
that. It has to be one by one and needs too time time, that your user is
able to do as well things. You are pulling on four sides of the datagrid.
(Filling, updating from it by the database, Reading by the user, updating by
the user). This kind of operations are and stay forever serial and are not
parallel. (Although they can exist in any sequence as is needed).

Just my thought reading your message.

Cor

Show quoteHide quote
"Tlink" <Tlink@online.nospam> schreef in bericht
news:uZuUrEzgGHA.4052@TK2MSFTNGP02.phx.gbl...
>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
>
>
>
>
Author
30 May 2006 3:11 AM
Tlink
I am unsure as to your response, what I am doing perhaps explained:

One thread that updates the database

One thread that reads the database and updates the datagrid

Does this help, as I am still confused?

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:eU%23eqn0gGHA.3756@TK2MSFTNGP02.phx.gbl...
> Tlink,
>
>
> It looks if you try to create a connected application using a Dataset.  If
> you are updatating the datasource of you cannot in the same time refill
> that. It has to be one by one and needs too time time, that your user is
> able to do as well things. You are pulling on four sides of the datagrid.
> (Filling, updating from it by the database, Reading by the user, updating
> by the user). This kind of operations are and stay forever serial and are
> not parallel. (Although they can exist in any sequence as is needed).
>
> Just my thought reading your message.
>
> Cor
>
> "Tlink" <Tlink@online.nospam> schreef in bericht
> news:uZuUrEzgGHA.4052@TK2MSFTNGP02.phx.gbl...
>>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
>>
>>
>>
>>
>
>
Author
30 May 2006 5:38 AM
Cor Ligthert [MVP]
Tlink,

What I want to say, is that the use of threads has in my opinion absolute no
sense.

The processes are complete serialized, so threads gives you only overhead
and trouble.

Cor

Show quoteHide quote
"Tlink" <Tlink@online.nospam> schreef in bericht
news:%23HIR8a5gGHA.3652@TK2MSFTNGP02.phx.gbl...
>I am unsure as to your response, what I am doing perhaps explained:
>
> One thread that updates the database
>
> One thread that reads the database and updates the datagrid
>
> Does this help, as I am still confused?
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:eU%23eqn0gGHA.3756@TK2MSFTNGP02.phx.gbl...
>> Tlink,
>>
>>
>> It looks if you try to create a connected application using a Dataset.
>> If you are updatating the datasource of you cannot in the same time
>> refill that. It has to be one by one and needs too time time, that your
>> user is able to do as well things. You are pulling on four sides of the
>> datagrid. (Filling, updating from it by the database, Reading by the
>> user, updating by the user). This kind of operations are and stay forever
>> serial and are not parallel. (Although they can exist in any sequence as
>> is needed).
>>
>> Just my thought reading your message.
>>
>> Cor
>>
>> "Tlink" <Tlink@online.nospam> schreef in bericht
>> news:uZuUrEzgGHA.4052@TK2MSFTNGP02.phx.gbl...
>>>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
>>>
>>>
>>>
>>>
>>
>>
>
>