get all form details in vb.net

别等时光非礼了梦想. 提交于 2019-12-13 22:16:03

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!