Here is the issue:
I have a simple ASP.NET form with 2 buttons.
One of them is created by dragging the button from the tools and the other I created directly in HTML:
<body>
<form id="Form1" method="post" runat="server">
<asp:Button OnClick="ABC" Runat="server" Text="rrr" id="Button1"></asp:Button>
<asp:Button id="Button2" runat="server" Text="Button"></asp:Button>
</form>
</body>
Button2 is created using tools and has the following Event Handler:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s As String = ""
End Sub
This "Private Event handler runs without any problem.
However for the button which is created under HTML , we have the following event handler:
Private Sub ABC(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Integer = 0
End Sub
For this one I get the following complile error:
Compiler Error Message: BC30390: 'WebApplication9.WebForm1.Private Sub ABC(sender As Object, e As System.EventArgs)' is not accessible in this context because it is 'Private'.
If I change the event handler scope from Private to protected this will work. Question is why private works for one event handler but not the other one.