Application.OpenForms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Luis Gustavo

    #1

    Application.OpenForms

    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 = "TelaMensag em_" & 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.Ope nForms("TelaMen sagem_" & i.ToString)
    .MyFunction(Me. Left - PosicaoInicialL eft, Me.Top -
    PosicaoInicialT op)
    End With
    Next

    []'s
    Luis Gustavo
    Sorry for my English


  • Herfried K. Wagner [MVP]

    #2
    Re: Application.Ope nForms

    "Luis Gustavo" <luis.gustavo@m edtech-angola.com> schrieb:[color=blue]
    > Can anyone say how I prevent the error: "'Function' is not a member of
    > 'System.Windows .Forms.Form'".[/color]

    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/>

    Comment

    Working...