Results 1 to 3 of 3

Thread: variable scope [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    variable scope [RESOLVED]

    I want to set a variable during the page load event then use it on the click event. Where do I declare the variable?
    Last edited by EyeTalion; Dec 17th, 2002 at 10:55 AM.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    At Class Level.

    Code:
    Public Class Form1
        Inherits System.Windows.Forms.Form
    
        Region " Windows Form Designer generated code "
    
        Dim test As String
    
        Private Sub Form1_Load(ByVal sender As System.Object, _
            ByVal e As System.EventArgs) Handles MyBase.Load
            test = "Testing"
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, _
            ByVal e As System.EventArgs) Handles Button1.Click
            MsgBox(test)
        End Sub
    
    End Class

  3. #3

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    thanks

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