Results 1 to 2 of 2

Thread: Using Assembly to display

Threaded View

  1. #1

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Using Assembly to display

    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:
    Code:
    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
    Thanks
    Last edited by toytoy; Dec 3rd, 2004 at 08:26 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width