Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 2.44 KB

how-to-put-a-value-in-a-property.md

File metadata and controls

44 lines (33 loc) · 2.44 KB
description title ms.date helpviewer_keywords ms.assetid
Learn more about: How to: Put a Value in a Property (Visual Basic)
How to: Put a Value in a Property
07/20/2015
property values [Visual Basic]
Visual Basic code, procedures
values [Visual Basic], properties
Visual Basic code, properties
properties [Visual Basic], values
c39401e5-b5fc-4439-8f31-ed640f7ce6ed

How to: Put a Value in a Property (Visual Basic)

You store a value in a property by putting the property name on the left side of an assignment statement.

The property's Set procedure stores a value, but you do not explicitly call it by name. You use the property just as you would use a variable. Visual Basic makes the calls to the property's procedures.

To store a value in a property

  1. Use the property name on the left side of an assignment statement.

    The following example sets the value of the Visual Basic TimeOfDay property to noon, implicitly calling its Set procedure.

    [!code-vbVbVbcnProcedures#11]

  2. If the property takes arguments, follow the property name with parentheses to enclose the argument list. If there are no arguments, you can optionally omit the parentheses.

  3. Place the arguments in the argument list within the parentheses, separated by commas. Be sure you supply the arguments in the same order that the property defines the corresponding parameters.

  4. The value generated on the right side of the assignment statement is stored in the property.

See also