2010-01-28 88 views
-1

我想列出當前項目中的所有表單。示例 listbox1.items.add(form1.name & form1.text)獲取vb.net中的所有表單詳細信息

我想加載當前項目中的所有表單詳細信息。

下面的代碼只給出了打開的表單。

For linti As Integer = Application.OpenForms.Count - 1 To 0 Step -1 
     Application.OpenForms.Item(linti).Text 
     Application.OpenForms.Item(linti).name 
    Next 

我想要所有的表格及其文本。我做什麼,先生,請幫我

+1

好吧,如果OP常用問這樣無聊的問題,他可能永遠不會得到一個可以接受的答案。 – 2010-01-28 06:59:15

+0

我將不得不採取回:http://stackoverflow.com/questions/692514/how-can-i-change-form-shape-in​​-vb-net/692982#692982 – 2010-01-28 07:34:01

回答

0

使用LINQ的一點,你可以嘗試

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