Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF, 078274121

Links

XODOX
Impressum

#1: simple global variables and routines

Posted on 2008-04-22 23:36:24 by Web Search Store

Hello,

Is there a place I can put a class of global variables and have them
available in the page_load routine?

Here is a class:

Public Class globalvar

Public ddd As String = "howdy"

Public sub writeit

response.write ddd

end sub



End Class


In the page_load I would access them like this:

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

ddd="goodbye"

writeit()
End Sub



This seems a hard thing to do in asp.net



I can put them all in a user control, and put an instance of it on each
page, if I have to.



Thanks for your help.



Scott

Report this message

#2: RE: simple global variables and routines

Posted on 2008-04-23 02:43:00 by pbromberg

Declare the fields as public static (shared in VB.Net) fields in a static
class, or declare them in Global.Asax as public static (shared). Then you can
refer to these with Global.MyVariableName = myobject;
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net


"Web Search Store" wrote:

> Hello,
>
> Is there a place I can put a class of global variables and have them
> available in the page_load routine?
>
> Here is a class:
>
> Public Class globalvar
>
> Public ddd As String = "howdy"
>
> Public sub writeit
>
> response.write ddd
>
> end sub
>
>
>
> End Class
>
>
> In the page_load I would access them like this:
>
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
> Handles Me.Load
>
> ddd="goodbye"
>
> writeit()
> End Sub
>
>
>
> This seems a hard thing to do in asp.net
>
>
>
> I can put them all in a user control, and put an instance of it on each
> page, if I have to.
>
>
>
> Thanks for your help.
>
>
>
> Scott
>
>
>
>
>
>
>

Report this message