Property Procedures


The syntax for read/write property procedures is as follows:

  Property property_name() As data_type     Get         ...     End Get     Set(ByVal Value As data_type)         ...     End Set End Property 

The syntax for a read-only property procedure is as follows:

  Public ReadOnly Property property_name() As data_type     Get         ...     End Get End Property 

The syntax for a write-only property procedure is as follows:

  Public WriteOnly Property property_name() As data_type     Set(ByVal Value As data_type)         ...     End Set End Property 

In all three of these cases, you don’t need to remember all the declaration details. If you type the first line (including the ReadOnly or WriteOnly keywords if you want them) and press Enter, Visual Basic creates blank property procedures for you.

The Property Get procedures should all assign return values, as in property_name = return_value or by using the Return statement, as in Return return_value.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net