Reflection...finally
Besides the LoadFrom method call for our Smart Client, I finally get another chance to use reflection! I wanted to create a data driven About form for our app. The current one is all hard-coded. Rather than read this from a table or xml file. everything I needed was in the assembly file. So, easy enough I do this:
Dim objCopyright As AssemblyCopyrightAttribute = AssemblyCopyrightAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly, GetType(AssemblyCopyrightAttribute))
Dim objProduct As AssemblyProductAttribute = AssemblyProductAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly, GetType(AssemblyProductAttribute))
Dim objCompany As AssemblyCompanyAttribute = AssemblyCompanyAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly, GetType(AssemblyCompanyAttribute))
Dim objTrademark As AssemblyTrademarkAttribute = AssemblyTrademarkAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly, GetType(AssemblyTrademarkAttribute))
lblProductName.Text = "Product Name: " & objProduct.Product.ToString
lblCompany.Text = "Company: " & objCompany.Company.ToString
lblTrademark.Text = "Trademark: " & objTrademark.Trademark
lblProductVersion.Text = "Version: " & Application.ProductVersion.ToString
lblProductPath.Text = "Executing in: " & Application.ExecutablePath
lblCopyRight.Text = "Copyright: " & objCopyright.Copyright.ToString