问题
i want list all forms in current project. example listbox1.items.add(form1.name & form1.text)
i want load all form details in current project.
the following code give for only open forms.
For linti As Integer = Application.OpenForms.Count - 1 To 0 Step -1
Application.OpenForms.Item(linti).Text
Application.OpenForms.Item(linti).name
Next
i want all form and its text. what i do sir please help me
回答1:
Using a bit of Linq you could try
Dim list = AppDomain.CurrentDomain.GetAssemblies().ToList(). _
SelectMany(Function(s) s.GetTypes()). _
Where(Function(p) (p.BaseType Is [GetType]().BaseType AndAlso _
p.Assembly Is [GetType]().Assembly))
For Each type As Type In list
Dim typeName As String = type.Name
Next
来源:https://stackoverflow.com/questions/2152739/get-all-form-details-in-vb-net