
Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/
What if there are about 50 types of MDI children and you don't know which
one for need to change? I tried the following code to get the type, but I
get an error:
"aType is not defined"
Thanks for your help,
Dan
Public Sub ChangeFormat()
Try
Dim frmAny As Form
For Each frmAny In Forms
Dim aType As Type
aType = frmAny.GetType
Try
DirectCast(frmAny, aType).GetTheme()
Catch ex As Exception
End Try
Next
End Try
End Sub
> * "Daniel Friend" <dan@donotspam.com> scripsit:
> > I have a bunch of mdi child forms and I use a collection for which forms are
[quoted text clipped - 17 lines]
>
> 'AnyForm' is the type of your MDI children.
Herfried K. Wagner [MVP] - 07 Sep 2004 22:57 GMT
* "Daniel Friend" <dan@donotspam.com> scripsit:
> What if there are about 50 types of MDI children and you don't know which
> one for need to change? I tried the following code to get the type, but I
> get an error:
> "aType is not defined"
Create an interface that all MDI child classes implement:
\\\
Public Interface ITheme
Sub GetTheme()
End Property
///
\\\
Public Class Form2
Inherits System.Windows.Forms.Form
Implements ITheme
Public Sub GetTheme() Implements ITheme.GetTheme
...
End Sub
.
.
.
End Class
///
> Public Sub ChangeFormat()
> Try
> Dim frmAny As Form
> For Each frmAny In Forms
\\\
DirectCast(frmAny, ITheme).GetTheme()
///
> Next
> End Try
> End Sub

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/