开发者

Export user controls in vb 2010 to a text file

开发者 https://www.devze.com 2023-04-07 23:41 出处:网络
Is it possible to export the user controls properties from my VB project to a text file or to excel. I have tried google ,but today google isn\'t my friend. I 开发者_StackOverflowam using VB 2010 expr

Is it possible to export the user controls properties from my VB project to a text file or to excel. I have tried google ,but today google isn't my friend. I 开发者_StackOverflowam using VB 2010 express

thanks


I think you are looking for something like this:

Const path = "C:\Test.txt"
Dim query = From assembly In My.Application.Info.LoadedAssemblies
            From type In assembly.GetTypes
            Where type.IsSubclassOf(GetType(UserControl))
            From prop In type.GetProperties
            Select PropInfo = String.Format("{0}{3}{1}{3}{2}",
                              assembly.GetName().Name,
                              type.Name, 
                              prop.Name,
                              vbTab)

If query.Any Then
      IO.File.WriteAllLines(path, query)
End If

Modify the LINQ query to your exact requirement. For example if you only want public properties with set-accessor that is writable:

 Where prop.CanWrite AndAlso Not prop.GetSetMethod Is Nothing AndAlso prop.GetSetMethod.IsPublic
0

精彩评论

暂无评论...
验证码 换一张
取 消