| title | How to: Put a Value in a Property (Visual Basic) | |||||
|---|---|---|---|---|---|---|
| ms.custom | ||||||
| ms.date | 07/20/2015 | |||||
| ms.prod | .net | |||||
| ms.reviewer | ||||||
| ms.suite | ||||||
| ms.technology |
|
|||||
| ms.topic | article | |||||
| helpviewer_keywords |
|
|||||
| ms.assetid | c39401e5-b5fc-4439-8f31-ed640f7ce6ed | |||||
| caps.latest.revision | 13 | |||||
| author | dotnet-bot | |||||
| ms.author | dotnetcontent |
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. [!INCLUDEvbprvb] makes the calls to the property's procedures.
-
Use the property name on the left side of an assignment statement.
The following example sets the value of the [!INCLUDEvbprvb]
TimeOfDayproperty to noon, implicitly calling itsSetprocedure.[!code-vbVbVbcnProcedures#11]
-
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.
-
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.
-
The value generated on the right side of the assignment statement is stored in the property.
xref:Microsoft.VisualBasic.DateAndTime.TimeOfDay%2A
Property Procedures
Procedure Parameters and Arguments
Property Statement
Differences Between Properties and Variables in Visual Basic
How to: Create a Property
How to: Declare a Property with Mixed Access Levels
How to: Call a Property Procedure
How to: Declare and Call a Default Property in Visual Basic
How to: Get a Value from a Property