Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
overloads? on page_load
Old 06-27-2008, 05:28 AM overloads? on page_load
Nazi370's Avatar
Skilled Talker

Posts: 70
Name: Nazirul
Trades: 0
Quote:
Warning 32 sub 'Page_Load' shadows an overloadable member declared in the base class 'requestactivity'. If you want to overload the base method, this method must be declared 'Overloads'.

what is overloads? and how to declare it? the problem was on page_load.. it not works..


Code:
     
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="requestactivity.aspx.vb" Inherits="requestactivity" %>

Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

            If Trim(Session("UserType")) = "" Then
                Response.Redirect("TidakSah.aspx")
            End If
               
            If Not Page.IsPostBack Then
                lblRequestedDate.Text = Format(Date.Now, "d/M/yyyy hh:mm:ss tt")
                lblRequestedBy.Text = Session("UserLogin")
            End If
       
        End Sub

in requestactivity.aspx.vb


Code:
Partial Class RequestActivity
    Inherits System.Web.UI.Page


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

    End Sub
End Class
Nazi370 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-27-2008, 01:29 PM Re: overloads? on page_load
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
You'll have to read up on OOP (object oriented programming) to get a better idea on overloading and such. There's just too much info to go into here. But the answer to your problem is to remove the empty Page_Load event handler in your base class (RequestActivity).

It's a very good idea, what you're doing, tho.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-27-2008, 02:32 PM Re: overloads? on page_load
RabidSniper's Avatar
Skilled Talker

Posts: 57
Name: Jesse
Location: Phoenix, AZ
Trades: 0
Two issues.

One.. you have AutoEventWireup set to FALSE.. which means that ASP.NET events like Page_Load dont have handlers assigned automatically.. Handlers are set like this: (C#)
this.Load += new System.EventHandler(this.Page_Load);
There is a similar yet different format for VB ill dig up here in a minute.

If you set AutoWireUp to True, then it will execute the Page_Load event handler method.


The error you are getting now, is related to the factor that you cant have two functions with the same signature in the same class. Your Code in front (ASPX page with a script tag) and your Code Behind are both PARTIAL classes.. which mean on compile they come toghether as one class.
So, although you can overload a method (have multiple methods with the same name but different signatures), you cant overload a method with the SAME signature.. So if you remove the empty Page_Load from your code behind (or move it from the Inline code to the Code Behind page), you will only have One Page_Load(Object,System.EventArgs) method signature.
__________________
The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair. -Douglas Adams
RabidSniper is offline
Reply With Quote
View Public Profile
 
Old 07-03-2008, 04:01 AM Re: overloads? on page_load
Nazi370's Avatar
Skilled Talker

Posts: 70
Name: Nazirul
Trades: 0
thanks... i have to remove the line <% @ ...

thanks for the explanation...

when i Called the *aspx.vb script... the function can not be private, must be public... i think it has relation with the OOP...

thanks John & Jesse ..
Nazi370 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to overloads? on page_load
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25166 seconds with 12 queries