Results 1 to 6 of 6

Thread: variable in the whole aspx page?

  1. #1

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    variable in the whole aspx page?

    hello all,

    this must be pretty simple though i cannot find a way to do this.

    basically, i want to define a variable that can then be used by the Subs and functions of the aspx page. not using a session variable, how can i do that?

    for instance, i get the variable
    VB Code:
    1. Dim EditorHeight As Long
    2. If Request.QueryString("type") = "full" Then
    3.    EditorHeight = 480
    4. End If
    and would like to use it on all subs. right now, i put this code in the Page_Load sub but when used in the other subs i get a 'variable not declared' error...

    thank you,

    wc.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Put it outside the sub.

  3. #3
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Specifically at the top just inside your class
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  4. #4

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    hi,

    thank you for your response!

    if i do put this at the top, before the Page_Load sub, i get an error stating that 'declaration expected' (though i do declare the variable).

    any ideas?
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  5. #5
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Can you post the code from the top of your code behind?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by wildcat_2000
    hi,

    thank you for your response!

    if i do put this at the top, before the Page_Load sub, i get an error stating that 'declaration expected' (though i do declare the variable).

    any ideas?
    What if you put it elsewhere, like outside the sub?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width