I have a userControl function that i want to set its action from the parent form.
I’ve already set userControl button action from that parent form.
and it worked like this :
in Form1.cs :
public Form1()
{
InitializeComponent();
fileManagerLocal1.SetSendButton(SendMethod);
}
private void SendMethod()
{
//whatever ...
}
in userControl1.cs :
public void SetSendButton(Action action)
{
btnSend.Click += (s, e) => action();
}
the code up works great.
but what i need is how do i set a Function action ..
in Form1.cs
public Form1()
{
InitializeComponent();
fileTransfer1.RefreshLocalFM(RefreshFM);
}
public void RefreshFM()
{
fileManagerLocal1.btnRefresh.PerformClick();
}
in userControl1.cs
public void RefreshLocalFM(Action action)
{
action(); // what should be in here ?
}
thanks in advance. 🙂
I’ve figured it out a solution ..
in Form1.cs :
in userControl1.cs: