Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Protected Function modifyStuff(ByVal a, ByRef b)
- 'notice we'll do stuff with a here, but it won't change in the original function
- a = 5
- 'now notice here we'll do something to b, and it will show afterwards
- 'this isn't generally a good practice, although it can be used
- 'but, it's really easy in large programs to get lost on what is getting manipulated where
- 'if you need to do something to b, do it here, return b and do b = modifyStuff() in your original function
- b = 5
- End Function
- Dim connStr = ""
- Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
- Dim a = 0.0
- Dim b = 0.0
- Response.Write("a before function = " & a & " b before function = " & b)
- modifyStuff(a, b)
- Response.Write("a after function = " & a & " b after function = " & b)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment