Application.OpenForms

  • Thread starter Thread starter Luis Gustavo
  • Start date Start date
L

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
 
Luis Gustavo said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top