Sandeep Sood
asked on
public functions/procedures/variables in asp.net (vb.net)
Hello.
Kindly guide me.
in my asp.net project, where i can place my public functions/procedures/varia bles that can be called from any other page/form
Without using a class.
i am using vb.net.
Kindly guide me.
in my asp.net project, where i can place my public functions/procedures/varia
Without using a class.
i am using vb.net.
or create a base page that inherits from system.web.ui.page
add all procedures/functions here
then inherit all your pages from this base instead of system.web.ui.page
or add your procedures / functions to master page if you already use master page...
add all procedures/functions here
then inherit all your pages from this base instead of system.web.ui.page
or add your procedures / functions to master page if you already use master page...
ASKER
>> or create a base page that inherits from system.web.ui.page
add all procedures/functions here
then inherit all your pages from this base instead of system.web.ui.page
Can you please give me an example/code.
add all procedures/functions here
then inherit all your pages from this base instead of system.web.ui.page
Can you please give me an example/code.
Public Class MyBasePage
Inherits System.Web.UI.Page
const clientid as integer = 101
const lang as string ="EN"
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private function cube (n as integer) returns integer as
begin
return n*n*n
end
End Class
then all other pages will inherit from MyBasePage not System.Web.UI.Page
Public Class Form1
Inherits MyBasePage
End Class
and here you should be able to use constants / functions and procedures as if they are in current page/form
but all of these solutions uses class!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot Experts !
put all your proc/functions here
if you dont need to initialize the class, then use "public shared" for others use "public/private"