Reputation: 1291
I guess I never looked careful enough at the code I added before. Can someone help elaborate on the signature of this function? It is from .net 3.5 code, there is no default parameter support. But this this
behaves just like default parameter. The function works just like GetFocusedControl(Form parentForm=this)
.
public static Control GetFocusedControl( this Form parent_form)
{
...
}
Upvotes: -1
Views: 40
Reputation: 112342
This is an extension method which must be placed in a static class. Assuming that the namespace of this extension method is "visible" and you have a form, you can call this method with:
Form frm = new Myform();
Control control = frm.GetFocusedControl();
As if this method was a member of the form itself.
See also:
Upvotes: 0