Results 1 to 3 of 3

Thread: VS2022 Errors - BC40056 - System.DirectoryServices doesn't contain a public member

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    9

    VS2022 Errors - BC40056 - System.DirectoryServices doesn't contain a public member

    HI VB Experts,

    My web application is working, however, when I open it in Visual Studio 2022, I get the error

    Warning BC40056 Namespace or type specified in the Imports 'System.DirectoryServices' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.


    I have checked references and this is installed.
    I looked at my header in the vb file and Imports System.DirectoryServices is listed but grayed out saying the import is not necessary.

    Use of this looks like this:

    Code:
        Public Sub PopAD(ByVal UsrName As String)
            Dim oroot As DirectoryServices.DirectoryEntry = New DirectoryServices.DirectoryEntry("LDAP://x.com")
            Dim osearcher As DirectoryServices.DirectorySearcher = New DirectoryServices.DirectorySearcher(oroot)
            Dim oresult As DirectoryServices.SearchResultCollection
            Dim result As DirectoryServices.SearchResult = Nothing

    Also, I posted a few pictures, which may help solve the issue?
    1. What does it mean when an aspx is "not available"
    2. Why do my files show as a name with a prefix 2_ or 3_ (different each time I load VB) rather than the PROJECT name like Helpdesk? This is in the errors window.

    I've done a Build, Rebuild, and Clean to no avail. No errors when performing any of these, and again, the web app works, just spewing all of these errors in Studio.
    Attached Images Attached Images    

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,569

    Re: VS2022 Errors - BC40056 - System.DirectoryServices doesn't contain a public membe

    If you import the namespace, it's not necessary to use the namespace in the types....
    So this
    Code:
    Dim oroot As DirectoryServices.DirectoryEntry
    Should be
    Code:
    Dim oroot As DirectoryEntry
    Or... you simply import System... which feels excessive. Or don't use an import and use the fully qualified name as you currently are (but may have to add System. to the front of it.)


    -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
    New Member
    Join Date
    Apr 2013
    Posts
    9

    Re: VS2022 Errors - BC40056 - System.DirectoryServices doesn't contain a public membe

    Hi TG,

    I removed the namespace from types so:
    Code:
        Public Sub PopAD(ByVal UsrName As String)
            Dim oroot As DirectoryEntry = New DirectoryEntry("LDAP://x.com")
            Dim osearcher As DirectorySearcher = New DirectorySearcher(oroot)
            Dim oresult As SearchResultCollection
            Dim result As SearchResult = Nothing
    but the error persists after rebuild/clean and closing VS and re-opening the project.

    Any other ideas?

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