Reputation: 49
I'm translating VB.NET code into C#.. there is a problem:
I have a method which gets Control
objects and I need to send different controls to it
private void ApplyToAllPictureBoxes(ref Control oControl, ViewMode Mode)
{
// ...
}
ApplyToAllPictureBoxes(ref Panel1, Mode);
ApplyToAllPictureBoxes(ref myFlowLayoutPanel, Mode);
But it throws
"The best overloaded method match has some invalid arguments"
this is the VB.NET code:
Private Sub ApplyToAllPictureBoxes(ByRef oControl As Control, ByVal Mode As ViewMode)
' ... '
End Sub
ApplyToAllPictureBoxes(myFlowLayoutPanel, Mode)
ApplyToAllPictureBoxes(Panel1, Mode)
How can I do that?
Upvotes: 1
Views: 95
Reputation: 34846
Try it without ref
, like this:
private void ApplyToAllPictureBoxes(Control oControl, ViewMode Mode)
{
// ...
}
Usage:
ApplyToAllPictureBoxes(Panel1, Mode);
ApplyToAllPictureBoxes(myFlowLayoutPanel, Mode);
Upvotes: 1