• 您的位置我爱Aspx >> VB.Net >> Chapter 3 Major VB.NET Changes(2)
  • Chapter 3 Major VB.NET Changes(2)

  • 作者:aspxer  来源:internet  日期:2007-5-20 14:01:36  关键字:.net
  • Chapter 3 Major VB.NET Changes(2)

    txtBillTo as TextBox

    Dim txtShipTo as TextBox

    txtShipTo =txtBillTo

    The line of code txtShipTo =txtBillTo sets the Text property of txtShipTo to the

    value in the Text property of txtBillTo . But what if that isn’t what you wanted?

    What if, instead, you wanted to create an object reference in txtShipTo that referred

    to the object txtBillTo ? You’d have to use this code:

    Set txtShipTo =txtBillTo

    As you can see, default properties require you to use the Set keyword to set refer-ences

    from one object variable to another.

    VB.NET gets around this problem by getting rid of default properties. Therefore, to

    copy the Text property from txtBillTo into the Text property of txtShipTo ,you’d

    have to use this code:

    txtShipTo.Text =txtBillTo.Text

    Setting the two variables equal to each other sets a reference from one to the other. In

    我对这篇文章有话说?
  • 广告位招租,广告代号:content_468_15
  • 上一篇:Chapter 4 Building Classes and Assemblies with VB.NET
    下一篇:Chapter 3 Major VB.NET Changes(1)