I wrote this class as part of a custom control in VB.Net. It lets me toggle the state of 3 linked labels, and set the text of each one using the Text property. That is all the user is allowed to do with it. I can convert the Enabled property and constructor without issue, however I am unsure as the best method to convert the Text property. A function would take 2 arguments, and an indexer would act on LabelExtender3, not on Text as it currently does in VB.Net. So what is the correct way to convert something like this?
Public Class LabelExtender3
Private lblTemp(2) As Label
Public WriteOnly Property Enabled As Boolean
Set(value As Boolean)
If value Then
lblTemp(0).ForeColor = Color.MediumBlue
lblTemp(1).ForeColor = Color.MediumBlue
lblTemp(2).ForeColor = Color.MediumBlue
Else
lblTemp(0).ForeColor = Color.SteelBlue
lblTemp(1).ForeColor = Color.SteelBlue
lblTemp(2).ForeColor = Color.SteelBlue
End If
End Set
End Property
Public WriteOnly Property Text(ByVal index As Integer) As String
Set(value As String)
lblTemp(index).Text = value
End Set
End Property
Friend Sub New(ByRef value1 As Label, ByRef value2 As Label, ByRef value3 As Label)
lblTemp(0) = value1
lblTemp(1) = value2
lblTemp(2) = value3
End Sub
End Class