Property: ReadOnly on public scope while Read-Write on friend or private scope

  • Thread starter Thread starter Saran
  • Start date Start date
S

Saran

Hi,

Below is my scenario...

I want to restrict my clients to access one of my class property
in ReadOnly mode. At the same time as an author of the component i
would like to have read-write access on it.

I tried to write 'Public ReadOnly' and 'Private WriteOnly', but
didn't work.

Is there a way other than doing (i) direct variable access or (ii)
through another property/method with a different name?

Thanks,
Saran.
 
Saran said:
Hi,

Below is my scenario...

I want to restrict my clients to access one of my class property
in ReadOnly mode. At the same time as an author of the component i
would like to have read-write access on it.

I tried to write 'Public ReadOnly' and 'Private WriteOnly', but
didn't work.

Is there a way other than doing (i) direct variable access or (ii)
through another property/method with a different name?

VB 2002/3: No
VB 2005: Yes:

Public Property Foo() As String
Get

End Get
Private Set(ByVal value As String)

End Set
End Property

Clients will not be able to Set the property.
 
Back
Top