G
Graham Blandford
Hi guys,
I'm sure I'm just not thinking far enough outside the box - am a VB6er
trying to enter this .NET OOP world.....
This is what I have...
For Each c As Control In Me.Controls
If c.GetType.ToString = "System.Windows.Forms.TextBox" Then
If c.Enabled = False Then
c.BackColor = System.Drawing.Color.White
End If
ElseIf c.GetType.ToString = "System.Windows.Forms.GroupBox" Then
For Each gc As Control In c.Controls
If gc.GetType.ToString = "System.Windows.Forms.TextBox" Then
If gc.Enabled = False Then
gc.BackColor = System.Drawing.Color.White
End If
End If
Next
End If
Next
As you an see, I am trying to change the colors for any textbox (inclouding
those sittiing in other controls) that is disabled - not very OO - in VB6 I
would probably have created a control array and done something like 'For
each Textbox as tb in Me.txtarray'....
However, I can see some really good possibilities in here, in that true OO
woild be to do this upon a event - such as painting/disabling the control.
Is there a more graceful way of doing this? Maybe in a handler?
Any ideas would be appreciated.
Thanks,
Graham
I'm sure I'm just not thinking far enough outside the box - am a VB6er
trying to enter this .NET OOP world.....
This is what I have...
For Each c As Control In Me.Controls
If c.GetType.ToString = "System.Windows.Forms.TextBox" Then
If c.Enabled = False Then
c.BackColor = System.Drawing.Color.White
End If
ElseIf c.GetType.ToString = "System.Windows.Forms.GroupBox" Then
For Each gc As Control In c.Controls
If gc.GetType.ToString = "System.Windows.Forms.TextBox" Then
If gc.Enabled = False Then
gc.BackColor = System.Drawing.Color.White
End If
End If
Next
End If
Next
As you an see, I am trying to change the colors for any textbox (inclouding
those sittiing in other controls) that is disabled - not very OO - in VB6 I
would probably have created a control array and done something like 'For
each Textbox as tb in Me.txtarray'....
However, I can see some really good possibilities in here, in that true OO
woild be to do this upon a event - such as painting/disabling the control.
Is there a more graceful way of doing this? Maybe in a handler?
Any ideas would be appreciated.
Thanks,
Graham