First of all, note that the default parameter in VB6 is passed as a reference pass, whereas the default parameter in vb.net is passed by: value passing.
Then we look at the reference passing in the following VB6 in contrast to the reference passing in the vb.net.
Reference passing in the VB6
Private Sub CommandButton1_Click () changename commandbutton1.caption End Sub Private Sub as String "namehasbeenchanged! " End Sub
After clicking the button
Vb. NET for reference passing
Public ClassForm1Private SubButton1_Click (Sender as ObjectE asEventArgs)HandlesButton1.Click changename (button1.text)End Sub Private SubChangeName (ByRefCaption as String) Caption="namehasbeenchanged!" End Sub End Class
After clicking the button
From the comparison above, it is found that the effect of reference passing in VB6 is very different from that of reference in vb.net: the same way that the property of a button is passed to the method body as a parameter, and is changed in the method body, but the effect is quite distinct. The caption of the button in VB6 has not been changed, and the text of the button in vb.net has been changed.
In VB6, when a property of an object is passed in a reference pass, the value of the object's property is not changed, but in vb.net, the value of the object's properties is changed when the property of the object is passed as a reference.
This should be particularly noticeable in the VB6 upgrade to VB.net project, where many bugs originate.
VB6 in the reference pass with VB. The difference between reference passing in net