Hello ,

I have a program where i am using timers to refresh the databinded to
daatgrid for every 10 seconds.Along with this i am having other functions
for updating , sorting etc.

the program terminates while in run mode due when i try to do
updating/sorting since refreshing function will be happening simultaneously.

How to solve this, by which type of thread.?

regards
Thanks
Ushas

Re: timer by hirf-spam-me-here

hirf-spam-me-here
Tue Aug 10 14:33:13 CDT 2004

* "usha" <usha.s@ionidea.com> scripsit:
> I have a program where i am using timers to refresh the databinded to
> daatgrid for every 10 seconds.Along with this i am having other functions
> for updating , sorting etc.
>
> the program terminates while in run mode due when i try to do
> updating/sorting since refreshing function will be happening simultaneously.

Can you post some code?

Is an error message shown/exception thrown?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Re: timer by usha

usha
Wed Aug 11 01:24:29 CDT 2004

switch(refr)

{

case "10" :

{

timer1.Start();

break;

}

reseting the timer in one function, and one event of the timer where i am
rebinding the datedrid.

There is an option to update also so while it is rebinding for each 10
seconds , unhandled exception occurs.

regards

ushas

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:OEWuuDxfEHA.2028@tk2msftngp13.phx.gbl...
> * "usha" <usha.s@ionidea.com> scripsit:
> > I have a program where i am using timers to refresh the databinded to
> > daatgrid for every 10 seconds.Along with this i am having other
functions
> > for updating , sorting etc.
> >
> > the program terminates while in run mode due when i try to do
> > updating/sorting since refreshing function will be happening
simultaneously.
>
> Can you post some code?
>
> Is an error message shown/exception thrown?
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



Re: timer by hirf-spam-me-here

hirf-spam-me-here
Wed Aug 11 05:32:57 CDT 2004

* "usha" <usha.s@ionidea.com> scripsit:
> There is an option to update also so while it is rebinding for each 10
> seconds , unhandled exception occurs.

Can you post the complete exception text? It's important to be able to
determine the exception's reason.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Re: timer by Stoitcho

Stoitcho
Wed Aug 11 09:05:30 CDT 2004

Hi usha,

Which one of the three timers do you use. This simultaneous update/sorting
makes me thing that you use System,Threading.Timer and you try to update the
grid from different thread. With WinForms this is wrong.

--

Stoitcho Goutsev (100) [C# MVP]


"usha" <usha.s@ionidea.com> wrote in message
news:OlaD1ZtfEHA.3700@TK2MSFTNGP12.phx.gbl...
> Hello ,
>
> I have a program where i am using timers to refresh the databinded to
> daatgrid for every 10 seconds.Along with this i am having other functions
> for updating , sorting etc.
>
> the program terminates while in run mode due when i try to do
> updating/sorting since refreshing function will be happening
simultaneously.
>
> How to solve this, by which type of thread.?
>
> regards
> Thanks
> Ushas
>
>
>
>
>
>



Re: timer by usha

usha
Wed Aug 11 23:16:46 CDT 2004

Hello

I still not used any threads thats why the problem.
I am using 6 timer control.for different timing inputs, and firing the same
event of refreshing.

regards
usha
"Stoitcho Goutsev (100) [C# MVP]" <100@100.com> wrote in message
news:u%23is1v6fEHA.236@tk2msftngp13.phx.gbl...
> Hi usha,
>
> Which one of the three timers do you use. This simultaneous update/sorting
> makes me thing that you use System,Threading.Timer and you try to update
the
> grid from different thread. With WinForms this is wrong.
>
> --
>
> Stoitcho Goutsev (100) [C# MVP]
>
>
> "usha" <usha.s@ionidea.com> wrote in message
> news:OlaD1ZtfEHA.3700@TK2MSFTNGP12.phx.gbl...
> > Hello ,
> >
> > I have a program where i am using timers to refresh the databinded to
> > daatgrid for every 10 seconds.Along with this i am having other
functions
> > for updating , sorting etc.
> >
> > the program terminates while in run mode due when i try to do
> > updating/sorting since refreshing function will be happening
> simultaneously.
> >
> > How to solve this, by which type of thread.?
> >
> > regards
> > Thanks
> > Ushas
> >
> >
> >
> >
> >
> >
>
>



Re: timer by Stoitcho

Stoitcho
Thu Aug 12 08:50:42 CDT 2004

Hi usha

That's right. What I'm trying to tell you is that if you use Therading.Timer
or Timers.Timer classes execution of the callback method when time span
expires is done in a separate worker thread. With Timer.Timer you have
options It has one property SynchronizingObject that can be set to reference
some of your controls. In this case the callback (Elapsed event handler)
will be executed in the UI thread. BTW if you drag and drop this timer from
toolbox it will set that property for you.
If you use System.Windows.Forms.Timer, though, its Tick event handler is
always executed in the UI thread, but it is not quite accurate. In other
words with System.Windows.Forms.Timer you will never run into raceing
situations. The same goes for System.Timers.Timer if its SynchronizingObject
is set. If you use System.Threading.Timer, you do have multithread execution
and you have to sync your code.

--
HTH
Stoitcho Goutsev (100) [C# MVP]


"usha" <usha.s@ionidea.com> wrote in message
news:OK5fqKCgEHA.3928@TK2MSFTNGP11.phx.gbl...
> Hello
>
> I still not used any threads thats why the problem.
> I am using 6 timer control.for different timing inputs, and firing the
same
> event of refreshing.
>
> regards
> usha
> "Stoitcho Goutsev (100) [C# MVP]" <100@100.com> wrote in message
> news:u%23is1v6fEHA.236@tk2msftngp13.phx.gbl...
> > Hi usha,
> >
> > Which one of the three timers do you use. This simultaneous
update/sorting
> > makes me thing that you use System,Threading.Timer and you try to update
> the
> > grid from different thread. With WinForms this is wrong.
> >
> > --
> >
> > Stoitcho Goutsev (100) [C# MVP]
> >
> >
> > "usha" <usha.s@ionidea.com> wrote in message
> > news:OlaD1ZtfEHA.3700@TK2MSFTNGP12.phx.gbl...
> > > Hello ,
> > >
> > > I have a program where i am using timers to refresh the databinded to
> > > daatgrid for every 10 seconds.Along with this i am having other
> functions
> > > for updating , sorting etc.
> > >
> > > the program terminates while in run mode due when i try to do
> > > updating/sorting since refreshing function will be happening
> > simultaneously.
> > >
> > > How to solve this, by which type of thread.?
> > >
> > > regards
> > > Thanks
> > > Ushas
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>