Sunday, August 14, 2005

some vb6 pitfalls

Sub ChangeText(ByRef ct As String)
ct = "Michael"
End Sub

Private Sub Command3_Click()
ChangeText Text1.Text
End Sub

the above code will not change tex1.text to michael

instead you must change it to following

Sub ChangeText(ByRef ct As String)
ct = "Michael"
End Sub

Private Sub Command3_Click()
dim S as string
ChangeText s
Text1.Text = S
End Sub

passing properties to byref parameters in vb.net actually works, we don't ever need anymore a work around, but not supported in c#, seems some kind of magic though :)

0 Comments:

Post a Comment

<< Home