I have defined a method in Form1 which uses the RunWorkerComple tedEventArgs as follows
I want to use this particular methon CallFun in different form.
Is it possible?
I tried the following in Form2
This give the following 2 errors:
1) The best overloaded method match for 'X.Form1.CallFu n(object, System.Componen tModel.RunWorke rCompletedEvent Args)' has some invalid arguments
2) Ecannot convert from 'System.EventAr gs' to 'System.Compone ntModel.RunWork erCompletedEven tArgs'
I am clueless where I am going wrong as I m very new to C#.
Any suggestions will be greatly appreciated.
Thank you.
Code:
public void CallFun(object sender, RunWorkerCompletedEventArgs e)
{
this.Status("Adding measurement ...");
if (!e.Cancelled)
{
if (e.Error == null)
{
string[] dirs = Directory.GetDirectories(this.RootPath, "*", SearchOption.AllDirectories);
foreach (string dir in dirs)
{
Console.Write(dir + "<br>");
}
Console.Write(dirs[17]);
}
else
{
this.Status(string.Concat("Error: ", e.Error.Message));
Thread.Sleep(500);
}
}
else
{
this.Status("Canceled!");
Thread.Sleep(500);
}
this.Status();
}
Is it possible?
I tried the following in Form2
Code:
Form1 form1 = new Form1(); form1.CallFun(sender, e);
1) The best overloaded method match for 'X.Form1.CallFu n(object, System.Componen tModel.RunWorke rCompletedEvent Args)' has some invalid arguments
2) Ecannot convert from 'System.EventAr gs' to 'System.Compone ntModel.RunWork erCompletedEven tArgs'
I am clueless where I am going wrong as I m very new to C#.
Any suggestions will be greatly appreciated.
Thank you.