We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 92,559 times

Contents

Related Categories

Introduction to Class Programming - Write-only property

tengtium

Write-only property

This kind of property is nearly the most perplex property that Visual Basic has to offer.  Because you cannot find anything useful for this property.  And usually, programmer find it  as unnatural of using this kind of property.  For completeness, write-only property can be implemented by omitting the corresponding Property Get.  A classical example is a Password property in a secured application usually with Login features.  You can assign and validate the login process of the user, but your user cannot read it, because it compromise the security of the your application.

Private m_Password As String

Property Let Password(ByVal strNewValue As String)
    ' Raise error if password in invalid
    ' .. code omitted..
    ' Else assign to member variable.
    m_Password = strNewValue 
End Property

Frequently, programmer prefer to create a method that accept the value as an argument, if the circumstances occurs like for our example. 

Comments