I want to use my own Enabled version to solve the ugly gray color problem.
So in my own Texbox control, I add the following code:
Public Overloads Property Enabled() As Boolean 'Or shadow - that is not theqestion - have the same problem.
Get
Return mEnabled
End Get
Set(ByVal Value As Boolean)
mEnabled = Value
'If MyBase.Enabled = False Then MyBase.Enabled = True
If mEnabled Then
Me.ReadOnly = False
Me.Text = "Enabled"
Else
Me.ReadOnly = True
Me.ForeColor = Color.Black
Me.BackColor = Color.White
Me.Text = "Ingen tilgang"
End If
End Set
End Property
Public Function ShouldSerializeEnabled() As Boolean
Return True
End Function
Put my textbox on a panel, my Enabled is never used when i set the panel.enabled = false
Make my own panel UserControl, make my own Enable version on that control.
Public Shadows Property Enabled() As Boolean
Get
Return mEnabled
End Get
Set(ByVal Value As Boolean)
mEnabled = Value
SetEnabled(Me, mEnabled)
End Set
End Property
I want to control the setting ofEnabled on the child control myself:
Sub SetEnabled(ByVal x As Control, ByVal flag As Boolean)
Dim ctrl As Control
For Each ctrl In x.Controls
ctrl.Enabled = flag 'Is not working OK
Next
End Sub
Sub SetEnabled(ByVal x As Control, ByVal flag As Boolean)
Dim ctrl As Control
For Each ctrl In x.Controls
Select Case ctrl.GetType.FullName
Case "wtControlLibrary.wtTextbox"
Dim a As wtControlLibrary.wtTextbox = CType(ctrl, wtControlLibrary.wtTextbox)
a.Enabled = flag 'Work OK
End Select
Next
End Sub
The big qestion are:
Why is not"ctrl.Enabled = flag" working?
Is it a bug in VB.NET, or is it by design? If it is by designe, then someone has miss somthing about OOP!