dcsimg
Results 1 to 8 of 8

Thread: [RESOLVED] Class Could Not Be Added

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2009
    Posts
    129

    Resolved [RESOLVED] Class Could Not Be Added

    Dear Forum,

    I created the following TestClass...

    This code works perfectly when I run it with a helper SUB MAIN but when I compile it to a standalone DLL I get a "Class Could not be added" message when I try to reference it in my project. Any thoughts on this issue?

    Code:
    Public Class TestClass
    
        Private MyCreationDate As Date
    
        Sub New()
            MyCreationDate = Date.Now
    
        End Sub
    
        Public ReadOnly Property CreationDate() As Date
    
            Get
                Return MyCreationDate
    
            End Get
        End Property
    
    End Class

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,264

    Re: Class Could Not Be Added

    Aaaah... this helper sub main... was it in the same project? Or was it in a different project?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2009
    Posts
    129

    Re: Class Could Not Be Added

    Quote Originally Posted by techgnome View Post
    Aaaah... this helper sub main... was it in the same project? Or was it in a different project?

    -tg
    It was in a different project. Once I tested the code I cut the TestClass code, started an entirely new class project and pasted the code there. It compiled successfully. I can see the DLL but when I try to add its reference to a new project I get the “cant load error”.

  4. #4
    Lively Member Goggy's Avatar
    Join Date
    Oct 2017
    Posts
    111

    Re: Class Could Not Be Added

    did you just copy the functional code, or did you also copied the Namespace?
    Utterly useless, but always willing to help

    As a finishing touch god created the dutch

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,204

    Re: Class Could Not Be Added

    What you describe must be a very specific problem but you have provided no specific information, so it would be a miracle if we could help. Start again from scratch and do things properly and pay attention to what you actually do and what actually happens. If it still doesn't work, you can then explain IN DETAIL what you did and what happened and we can then reproduce those steps and see if we can reproduce the result.

  6. #6
    Frenzied Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,024

    Re: Class Could Not Be Added

    Does the class library depend on any other references? Does the executable that references the class library depend on any other references? What versions of the framework are both these two projects using? Are they both targeting the same cpu type or is one forced to 64bit and the other 32bit or similar?

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Sep 2009
    Posts
    129

    Resolved Re: Class Could Not Be Added

    Problem resolved by BROWSING to the correct DLL. The ADD REFERENCE window is VS still showed old DLL files that were deleted and therefore could not be added. Evidently this list does not get updated when items are deleted. Is there a way to removed these item from the list? I could not see a way to do this.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2009
    Posts
    129

    Re: [RESOLVED] Class Could Not Be Added

    Re: last post entry... Disregard, I found out how to REMOVE references.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width