Jump to content
Sign in to follow this  

[Resolvido] Lista de todos os formulários

Recommended Posts


Boas, existe maneira de ter a Tag de todos os formulários do meu projeto?

O código que utilizo para ver a lista te todos os formulários:

Dim Forms As New List(Of String)()
Dim formType As Type = Type.GetType("System.Windows.Forms.Form")

	For Each t As Type In sender.GetType().Assembly.GetTypes()
		If UCase(t.BaseType.ToString) = "SYSTEM.WINDOWS.FORMS.FORM" Then
		End If

Aqui consigo apenas o nome, não consigo obter a Tag deles

Share this post

Link to post
Share on other sites


achei este code... deve servir

        Dim allForms() As Form = (From t As Type In Me.GetType().Assembly.GetTypes() _
                                        Where t.BaseType Is GetType(Form) _
                                        Let f = DirectCast(Activator.CreateInstance(t), Form) _
                                        Select f).ToArray

       For Each f As Form In allForms

Edited by thoga31

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.