Little VB .NET Syntax Problem!!
-
Hi How to make property indexers in VB .NET... Against my will, I am standing beside my own shadow! :(( ------------------- Therez No Place like ... 127.0.0.1
The following should work:
Public Property Notes(ByVal index As Integer) As String Get Return m_Notes(index) End Get Set(ByVal Value As String) m_Notes(index) = Value End Set End Property
The when you're using the property:myClass.Notes(2) = "Some message!"
Hope this helps. Dan Morris -
The following should work:
Public Property Notes(ByVal index As Integer) As String Get Return m_Notes(index) End Get Set(ByVal Value As String) m_Notes(index) = Value End Set End Property
The when you're using the property:myClass.Notes(2) = "Some message!"
Hope this helps. Dan Morris -
he he he he.... I want to do myClass(2) = "Some message!" :) Anyway, thanks for your time... I appreciate it :) fadee ------------------- Therez No Place like ... 127.0.0.1
-
-
The following should work:
Public Property Notes(ByVal index As Integer) As String Get Return m_Notes(index) End Get Set(ByVal Value As String) m_Notes(index) = Value End Set End Property
The when you're using the property:myClass.Notes(2) = "Some message!"
Hope this helps. Dan MorrisAdd a "Default" to that property and then you can call it as myClass(2) = "SomeMessage". Default Public Property Notes(ByVal index As Integer) As String Get Return m_Notes(index) End Get Set(ByVal Value As String) m_Notes(index) = Value End Set End Property