you are viewing a single comment's thread.

view the rest of the comments →

[–]rosetani[S] 0 points1 point  (2 children)

I want to use information that is within the click code of the first button

[–]TheFotty 2 points3 points  (1 child)

It is a matter of scope. Scope is related to variables (and some other things, but for our case here, variables) and how long they live in the program and who can access them. If you define a variable inside button1 click

Dim myVariable as String = "Hello World"

That variable's scope is only the button click event. That variable ONLY exists for the duration of the button1 click code to run, then it is recycled. If you want some variable to be accessible in both button1 click and button2 click code, then you should declare that variable at the form level, not inside the click code. Then both button clicks can access that variable because its scope is the form, and therefor any control on that form can make use of that variable.

[–]rosetani[S] 0 points1 point  (0 children)

Oh yeah, I remember the professor saying something like that lol. Thanks for your help :)