BC30002: Type 'DirectorySearcher' is not defined.

bobw2829

Member
Joined
May 25, 2007
Messages
7
Programming Experience
3-5
Hi All,

Don't know why I'm getting this error. I've added the System.DirectoryServices lib to my project and am importing System.DirectoryServices.

Here is the code that tries to access DirectorySearcher (App_Code/DBaccess):
VB.NET:
Imports System.DirectoryServices

Namespace App_Code
    Public Class DBaccess

        Public Sub New()
        End Sub

        Dim ds As New DirectorySearcher

    End Class

End Namespace

Also, if I move the DBaccess.vb file to the root directory, I do not see the error. So why can't I access the DirectorySearcher from within App_Code directory?

Thanks,
Bob W.
 
Last edited:
Anybody have an idea? This is crazy. All sense tells me that this should work. The DirectoryServices reference has been added to the project. Why can't I access the System.DirectoryServices lib in WebApplication1\App_Code, but can access it in the root directory, WebApplication1? This is really starting to get under my skin!!!!!!
 
Looks like I figured it out. Problem was, under References, System.DirectoryServices property Local Copy was set to False. Changed it to True and now am able to access DirectoryServices from other than the application root directory. :D
 
Can't create Object!

This is crazy, or is it just me. I'm trying to simply create an object from a class, but VS can't see the class.

Here is the class:

VB.NET:
Imports System

Namespace App_Code
    Public Class DBhandler

        Public Sub New()
        End Sub

        Public Function Search()
            ...
            Return something
        End Function

    End Class
End Namespace

And here's the call:

VB.NET:
Namespace App_Code
Friend NotInheritable Class DBaccess

    Private Sub New()
    End Sub

    Public Shared Sub AuthenticateUser()
        [color=red]Dim objDBhandler As New DBhandler[/color]
    End Sub

End Class
End Namespace

Their both in the same directory. There are no Private restrictions. What's going on?

Thanks,
Bob
 
This is crazy, or is it just me.
It seems its just you :).
I see no problem with the code. What error are you getting? (please always post the error if available).
Their both in the same directory.
What is the their (should be they're) you are writing about? I assume you mean the code blocks are in separate files in the same directory. That shouldn't matter.
 
Back
Top