Hi all could someone explain why is this happening?
Ive got a first piece of code:
Which happily makes value of s = "asdf" and value of ss = "zxcv"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
now have a look at another peice of code
Which makes tn.text and tnn.text = "zxcv"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
Why????




Reply With Quote