Hi
I try to use assembly to display the name to the form but the error state that [Assembly] and AssemblyCompanyAttribute....AssemblyCopyrightAttribute and AssemblyTitleAttribute are not defined.... Why ?
Here is the code:
ThanksCode:Private Sub frmAbout_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Load the labels from AssemblyInfo.vb 'Display attribute informaation Dim objAttributes() As Object Dim asmInfo As [Assembly] Dim atrCompany As AssemblyCompanyAttribute Dim atrCopyright As AssemblyCopyrightAttribute Dim atrTitle As AssemblyTitleAttribute asmInfo = [Assembly].load("Ch01HandsOn") objAttributes = asmInfo.GetCustomerAttributes(False) Dim objItem As Object 'Convert from object to desired types 'Need Select Case because ordr of attributes in array varies For Each objItem In objAttributes Select Case objItem.GetType.ToString() Case "System.Reflection.AssemblyTitleAttribute" atrTitle = CType(objItem, AssemblyTitleAttribute) Me.Text = "About" & atrTitle.Title.ToString() Case "System.Reflection.AssemblyCompanyAttribute" atrCompany = CType(objItem, AssemblyCompanyAttribute) lblCompany.Text = atrCompany.Comapny.ToString() Case "System.Reflection.AssemblyCopyrightAttribute" atrCopyright = CType(objItem, AssemblyCopyrightAttribute) lblCopyright.Text = atrCopyright.Copyright.ToString() End Select Next End Sub


Reply With Quote

