Timer

  • Thread starter Thread starter Saurabh Sharma
  • Start date Start date
S

Saurabh Sharma

Hi

I am using a Timer in the code. When ever the event elapses i populate a
datagrid. Without timer it was working okay but i need timer coz of some
constraints.

After using timer whenever datagrid populates it makes a horizontal
scrollbar just above already existing scrollbar and also whenever i close
the program it hangs

Please Help

Saurabh
 
Saurabh,

What kind of timer are you using? Is it the one in the
System.Windows.Forms namespace, or from the System.Timers namespace. If it
is the latter, then the timer event is being fired on a thread that is not
the UI thread. In this case, you will have to call the Invoke method on a
control in the UI thread when you set your data source (or change the
existing one).

Hope this helps.
 
Thanx that helped

Saurabh
Nicholas Paldino said:
Saurabh,

What kind of timer are you using? Is it the one in the
System.Windows.Forms namespace, or from the System.Timers namespace. If
it is the latter, then the timer event is being fired on a thread that is
not the UI thread. In this case, you will have to call the Invoke method
on a control in the UI thread when you set your data source (or change the
existing one).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Saurabh Sharma said:
Hi

I am using a Timer in the code. When ever the event elapses i populate a
datagrid. Without timer it was working okay but i need timer coz of some
constraints.

After using timer whenever datagrid populates it makes a horizontal
scrollbar just above already existing scrollbar and also whenever i close
the program it hangs

Please Help

Saurabh
 
Back
Top