namespace or type specified in the imports doesn't contain any public member or cannot be found.

ipjyo
ipjyo used Ask the Experts™
on
Hi,
I am getting the error as follows when I try to import a namespace which is already added in the References tab. I have some functions that are exposed as public. I need to call these public functions from my test program.
Could anybody help me with this error? I have been trying to resolve this but no luck worked yet.
Please let me know if I need to provide additional information. Thank you.
"namespace or type specified in the imports doesn't contain any public member or cannot be found. Make sure the type or namespace is defined and contains atleast one public member. Make sure the imported element name does nt use any aliases."

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Obadiah ChristopherDeveloper User Interface
Commented:
Have u added the dll using the Reference --> Add Reference
Most Valuable Expert 2012
Top Expert 2014
Commented:

Author

Commented:
yes, I have added the dll using Reference-->Add Reference.
Actually I was trying to import namespace in my test program but I have not enclosed the class which I am trying to import in a namespace. Now when I try to refer the class name directly it is working.
I removed the "imports" statement.
my question now is, can we not have an import statement if the base class is not enclosed in a namespace?
Thank you
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Most Valuable Expert 2012
Top Expert 2014
Commented:
Import statement is used to import NAMESPACE. If there is no namespace then you can not use the import statement. Basically, you have to fully qualify the classnames if you do not import the namespace but if there is no namespace around the class then you can use it directly. For example, if you do not use import, you have to do IO.File.Exists() but if you use Imports System.IO then you can directly use File.Exists().

Author

Commented:
Now I understand how it works. Thank you very much.
I have the same problem! I have downloaded the DLLs from the internet, added to my project's References and checked them on the "Imported namespaces".

I'm able to reference them but when start compiling it, it loses the reference and I get that error.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial