Ryden Choi Ryden Choi - 1 year ago 91
C# Question

How can I change invoke(new action) under c# 3.0

I made a WinForm program under .Net Framework 4.5

And now I trying to make it under .Net Framework 3.0

Using thread, call the "Control.Invoke" to Datagridview, but it's not work..

My Code is like this

private void btnStart_Click(object sender, EventArgs e)
Thread th = new Thread(new ThreadStart(StartAnalyseTheSite));
th.IsBackground = true;

private void StartAnalyseTheSite()

private void InsertWebApplicationInfo()

private void SelectWebApplicationInfo()
this.Invoke(new Action(() => { grdWebApplication.DataSource = dtwebApp; }));


this.Invoke(new Action(() => { grdWebApplication.DataSource = dtwebApp; }));

This code is not work...

Error Message is ->

'Action' does not contain a constructor that takes 1 arguments

How can I change that code?? Somebody help me

Answer Source

You can use such code:

this.Invoke(new MethodInvoker(delegate() { /*Do sommething*/ }));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download