I am converting some classes from C#
to VB.NET
and this line can't be converted properly. I tried few online converters but they don't seem to work.
this.mGrid.RowDataBound += new GridViewRowEventHandler(RowDataBoundHandler);
Converted VB.NET
that does not work.
Me.mGrid.RowDataBound += New GridViewRowEventHandler(RowDataBoundHandler)
The following are the two errors I am getting from that. Can anyone help me out coz my brain is dead now.
Thanks,
Error 4 Delegate 'System.Web.UI.WebControls.GridViewRowEventHandler' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor. C:\My Projects\PMS\App_Code\GridViewHelper.vb 110 62 C:\My Projects\PMS\
Error 3 'Public Event RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event. C:\My Projects\PMS\App_Code\GridViewHelper.vb 110 9 C:\My Projects\PMS\
Try using AddHandler
if you want to bind the event manually:
AddHandler Me.mGrid.RowDataBound, AddressOf RowDataBoundHandler
Or you can bind the event in the ASPX markup:
<asp:GridView ... RowDataBound="RowDataBoundHandler" runat="server" />
Or use Tim Schmelter's approach.