Sub Page_Init method: Event init cannot be found

asp.net, events, init, vb.net

Solution

I am not VB.NET expert (I am writing on C#) but i can say that the cause of the problem is that you need to override OnInit method instead of Page_Init.

So, you need to use the following code:

Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Friend Overrides Sub OnInit(ByVal e As EventArgs)
        MyBase.OnInit(e)
    End Sub
End Class

Problem

The following method is return an error: 'Event init cannot be found' and get error on System.Web.UI.Page Visual Studio 2010, framework 3.5 ``` Public Class_default Inherits System.Web.UI.Page Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init End Sub ```

Original source