could someone explain the difference to me
Hi all could someone explain why is this happening?
Ive got a first piece of code:
Code:
Private Function Clone2(ByVal s As String) As String
clone2 = s
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dim s as string
dim ss as string
s = "asdf"
ss = clone2(s)
ss = "zxcv"
End Sub
Which happily makes value of s = "asdf" and value of ss = "zxcv"
now have a look at another peice of code
Code:
Public Function Clone2(ByVal tn As TreeNode) As TreeNode
clone2 = tn
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dim tn as new treenode()
dim tnn as treenode
tn.text = "asdf"
tnn = clone2(tn)
tnn.text = "zxcv"
End Sub
Which makes tn.text and tnn.text = "zxcv"
Why????