Results 1 to 5 of 5

Thread: make the variable known[solved]

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    61

    Resolved make the variable known[solved]

    if i do something like this how would i make the variable "play" value
    change all over the program?

    VB Code:
    1. Dim play as byte
    2.  
    3.  Private Sub Form_Load()
    4. play = 1
    5. End Sub
    6.  
    7. Private Sub start_Click()
    8. If play = 1 Then
    9. starter
    10. play = 0
    11. End If
    12. End Sub
    13.  
    14. Sub starter()
    15.   Timer1.Interval = 1  ' for 1 millisec
    16.   Timer1.Enabled = True
    17.     stupid.Caption = ""
    18.     play = 1
    19.     countt.Caption = "Count to?"
    20.     End If
    21. Next i
    22. End Sub

    something like that
    in the Sub starter, play is changed to "1"
    but does it only change it in that Sub? or does it change the global variable?
    do i make sense or do i got it all wrong?
    Last edited by rodrigorules; Apr 25th, 2005 at 05:05 PM.

  2. #2
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: make the variable known

    it doesnt change for each form, but it does change for the form you called it on.

    so if you gave it the value 1 in form load, it will remain 1 until you change it

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    61

    Re: make the variable known

    but when u change the vaule in one Sub, does it change it all over that same form?

  4. #4
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: make the variable known

    yep

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: make the variable known

    Quote Originally Posted by rodrigorules
    but when u change the vaule in one Sub, does it change it all over that same form?
    Yes, as long as you have it defined in the Declarations section of the form as you seem to have done.

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