Home All Groups Group Topic Archive Search About

Application.OpenForms

Author
15 Mar 2006 4:45 PM
Luis Gustavo
FrameWork 2

Hi.

Can anyone say how I prevent the error: "'Function' is not a member of
'System.Windows.Forms.Form'".

I have a form where I have many public functions created for me. The user
will can open 'x' forms(the same form.) and I'm accessing this forms with
the new function "OpenForms".
I named the forms: "MyForm_" & i.tostring.
But when I try put my function is returned the error.


The code:
' Here I open the forms.

        Dim i As Integer = 0
        Dim _frmMensagens(2) As FrmMensagens

        For i = 0 To 2
            _frmMensagens(i) = New FrmMensagens
            QtdeFormsMsgs += 1
            With _frmMensagens(i)
                .FormDono = Me
                .Name = "TelaMensagem_" & i.ToString
                .Posicao = i
                .Show()
            End With
        Next

'Here I try to access my function in form, but is returned de error.
        Dim i As Integer = 0

        For i = 0 To QtdeFormsMsgs
            With Application.OpenForms("TelaMensagem_" & i.ToString)
                .MyFunction(Me.Left - PosicaoInicialLeft, Me.Top -
PosicaoInicialTop)
            End With
        Next

[]'s
Luis Gustavo
Sorry for my English

Author
15 Mar 2006 4:49 PM
Herfried K. Wagner [MVP]
"Luis Gustavo" <luis.gust***@medtech-angola.com> schrieb:
> Can anyone say how I prevent the error: "'Function' is not a member of
> 'System.Windows.Forms.Form'".

You'll either have to turn 'Option Strict' off to use late binding to
dynamically access the member or cast the reference returned by 'OpenForms'
to the form type containing the member.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>