samccxr
samccxr

Reputation: 3

InvalidOperationException error in Invoke or BeginInvoke cannot be called on a control until the window handle has been created on BeginInvoke

InvalidOperationException error in Invoke or BeginInvoke cannot be called on a control until the window handle has been created on BeginInvoke i am getting an error while throw an exeception ex where the ex shown BeginInvoke error and can u refer some method.And i getting error in ex where throws the error can someone please tell some other method? I thank in advance!!


private void UpdateGrid(DataTable table)
{
if (dataGridView1.InvokeRequired)
{
 UpdateGridThreadHandler handler = UpdateGrid1
dataGridView1.BeginInvoke(handler, table) 
             }
 else
             {
 dataGridView1.DataSource = table;
 
             }
         }
 
 }
 
 //and the Exception i tried and i keeping try as empty
 try
 {
 }
 catch(Exeception ex)
 {
 writelog.writeline(DateTime.Now.ToString()+"-LoadData-"+ex.Message)
>!  }

where ex indicates the error of Invoke or BeginInvoke cannot be called on a control until the window handle has been created

Upvotes: 0

Views: 105

Answers (0)

Related Questions