i want to fill datagrid in c#.net after particular time interval...so i make one function which is simply fire "select" query on table and fill grid, and i call this function using timer...Here in the below code FillGrid is function which has simple select query based on some condition and it fill grid value after every 10 seconds....
System.Timers.Timer Mtm = new System.Timers.Timer();
Mtm.Elapsed += new ElapsedEventHandler(FillGrid);
Mtm.Interval = 10000;
private void FillGrid(object source, ElapsedEventArgs e)
string Query = "select * from reservation where status = 0";
SqlDataAdapter dataAdp = new SqlDataAdapter(Query, cnn);
DataSet ds = new DataSet();
dataGridView.DataSource = ds.Tables["Reservationdata"].DefaultView;
while Refreshing Fill DataGridView After particular time interval using timer in C#.net i got an exception.
The Exception is - "Cross-thread operation not valid: Control tab1 accessed from a thread other than the thread it was created on."
if u have any other idea to refresh a datagrid then plz tell me....
Please Help me.....i need ur help..