Convert c# to vb.net ‘RaiseEvent’ statement to raise an event to use Gzip

eventsgzipraiseraiseevent

I have convert class from c# to vb.net .. My point that I want to compress asp.net page to reduce the page size ,, Problem is after i convert to vb.net ,i have this error

Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC32022: 'Public Event
PostRequestHandlerExecute(sender As Object, e As System.EventArgs)' is
an event, and cannot be called directly. Use a 'RaiseEvent' statement
to raise an event.

Source Error:

Line 178:

Line 179: Private Sub Init(context As HttpApplication) Implements IHttpModule.Init

Line 180: context.PostRequestHandlerExecute += New EventHandler(context_BeginRequest)

Line 181: End Sub

Line 182:

im trying to implement Gzip for asp.net …
thanks in advance ….

Best Answer

AddHandler is the VB.NET equivalent to C#’s += when used on events.

AddHandler context.PostRequestHandlerExecute, AddressOf context_BeginRequest
Related Topic