VB.NET Handles too C#

  • Thread starter Thread starter nic
  • Start date Start date
N

nic

Hi,

In VB.NET there is following code :

Private Sub mItems_Invalidate() Handles Columns.Invalidate
DataBind()
End Sub

How can I translate that to C# I know following
private void mItems_Invalidate()
{
DataBind();
}

But what with Handles Colums.Invalidate??

Thanks,
nic
 
There's no similar operator in C#. You'll have to manuall subcribe to that
event, for example during the Form.Load:

Columns.Invalidate += new theDelegateType(mItems_Invalidate);
 
Nic,

You will have to manually assign the event handler, like so:

// Add the event handler.
Columns.Invalidate += new EventHandler(this.mItems_Invalidate);

EventHandler might not be the correct type of the delegate. You must
change the type to whatever the delegate called by the event is.

Hope this helps.
 
Back
Top