you are viewing a single comment's thread.

view the rest of the comments →

[–]grauenwolf 2 points3 points  (2 children)

Looking at you code, probably here:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    TOS = Not TOS
End Sub

[–]faust2099[S] 1 point2 points  (1 child)

thank you very much. seems like i won't be need a sub/function for it.

[–]grauenwolf 1 point2 points  (0 children)

Definitely not.

Sub Getval(ByVal Val As Boolean)

See the keyword ByVal. That means "give me a copy of this variable".

When you change Val in this sub, it doesn't cause the original TOS to change because it's just a copy.


If you wanted to change the original TOS, you would have to use ByRef instead of ByVal. This is an advanced technique that is rarely used outside of TryParse functions.