Default property

We can use
text1 = "ABC"
instead of
text1.text = "ABC"

However, how to set a default property for a clas, or control.
clsBar.Barcode = "1234567"
can be write by using

clsBar = "1234567"

I think it can be set using some tool in VB. But I can't remember, so, can some body help.

Thank you.

Comments

  • : We can use
    : text1 = "ABC"
    : instead of
    : text1.text = "ABC"
    :
    : However, how to set a default property for a clas, or control.
    : clsBar.Barcode = "1234567"
    : can be write by using
    :
    : clsBar = "1234567"
    :
    : I think it can be set using some tool in VB. But I can't remember, so, can some body help.
    :
    : Thank you.
    :
    [grey]Use the Object Explorer [F2] and select the property you want.
    Click the Right mouse button, and select "Properties" from the popup menu. This will bring up the properties dialogue. Press the "Advanced >>" button and under "Attributes", check the "User Interface Default" check box.

    DjSpirit, support is hereby to be considered an occupational hazard[/grey]
  • I try it, but it come with 438 error

    object doesn't support this type of method and properties.

    What wrong with this.

    : : We can use
    : : text1 = "ABC"
    : : instead of
    : : text1.text = "ABC"
    : :
    : : However, how to set a default property for a clas, or control.
    : : clsBar.Barcode = "1234567"
    : : can be write by using
    : :
    : : clsBar = "1234567"
    : :
    : : I think it can be set using some tool in VB. But I can't remember, so, can some body help.
    : :
    : : Thank you.
    : :
    : [grey]Use the Object Explorer [F2] and select the property you want.
    : Click the Right mouse button, and select "Properties" from the popup menu. This will bring up the properties dialogue. Press the "Advanced >>" button and under "Attributes", check the "User Interface Default" check box.
    :
    : DjSpirit, support is hereby to be considered an occupational hazard[/grey]
    :

  • Why not just declare the properties?

    sidebar: We VB guy's (ok and gals) get lazy with the use of default properties. Always declare properties (even if default) - this will save [italic] much [/italic] time when you (or someone else) has to debug the project at some time in the future (I've been there). Also, VB.NET does not have default properties so why not get used to this now - it's good coding practice.


    jim b


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories