Question re use of Property Let

J

jfp

I understand the basic concept of Property Let -- as in this from the VB
Help:
-=-=
The Property Let is defined In some class module:

Private IsInverted As Boolean

Property Let Inverted(X As Boolean)
IsInverted = X
If IsInverted Then

(statements)
Else
(statements)
End If
End Property

and it is then used in some other module as in
Object.Inverted = True
-=-=
OK.
My book on VB (VB&VBA in a NutShell) states that the definition of a
property Let can have more than one argument, with the last one being
the value to be assigned to the property -- sort of like :

Property Let Inverted(I As Integer, X As Boolean)
IsInverted = X
' also do some stuff with I
End Property

I have seen NO examples of what the call to the Property Let would look
like in this case - where would the other argument(s) go ?
 
M

Media Lint

Here's how you might use this:

HERE IS A CLASS (I will then call class1)

Private IDMatrix(0 To 100) As String

Public Property Let MatrixName(IDNumber As Integer, sName
As String)
IDMatrix(IDNumber) = sName
End Property

Public Property Get MatrixName(IDNumber As Integer) As
String
MatrixName = IDMatrix(IDNumber)
End Property

HERE IS THE IMPLEMENTATION in a module

Dim cl1 As New Class1

Sub Test()
cl1.MatrixName(10) = "George"
MsgBox cl1.MatrixName(10)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top