passing values into global variables

Results 1 to 2 of 2

Thread: passing values into global variables

  1. #1
    Join Date
    Dec 1969

    Default passing values into global variables

    hi, i have a declared a global variable at the top of my code. then within a subroutine, i am passing a value into the global variable. when i do a response.write WITHIN the subroutine, the value is being passed into the global variable because the variable prints out the value. now i want this global variable with the value stored in it, to be used within another subroutine. so far i cant get this to work. my code is shown below.....<BR><BR>Dim QNo As Integer<BR>Dim QAn As Integer<BR><BR>Sub Begin_Click (Src As Object, E As EventArgs)<BR><BR>&#039;other code goes here........<BR><BR>QNo = objDataReader("QNo1")<BR>QAn = objDataReader("QAn1")<BR><BR>End Sub<BR><BR><BR>Sub Finish_Click (Src As Object, E As EventArgs)<BR><BR>Response.write (QNo)<BR><BR>If QNo = QAn Then<BR>message100.text = "correct"<BR>Else<BR>message100.text = "wrong"<BR>End If<BR>End Sub<BR><BR>this will not work as in the sub Finish_Click, the variable QNo is being recognised as 0 and not the value taken from Begin_Click sub. can anyone tell me how i can pass the value recieved from Begin_Click and store it so i can use it in Finish_Click. thanx....<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: passing values into global variables

    Change the way your Variables are declared.<BR><BR>Public QNo As Integer<BR>Public QAn As Integer<BR>

Posting Permissions

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