namespace or type specified in the imports doesn't contain any public member


I am getting the above error when I hover over the:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Default" Title="Caller" %>

on the apsx page.

Basically the original project was just 1 .vb file (default.aspx.vb) that contained hundreds of lines of script.  To make it more manageable I split out the similar functions into two .vb files and created namespaces for them.  I then added the two namespaces to the web.config file.  

I thought that this is all I would need to do, but I am still getting the error above.

I can't add them as a reference as they are not compiled dlls.  Normally a website has an app_code directory which holds this, but as this is a project, I don't appear to have one, nor is there an option to add under add > add folder.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Inside default.aspx.vb, in the top, there's a list of imports. One of those imports does not have any public member. I'm of the opinion that that is harmless, but apparently you get an error thereof. Can you show what you have in the imports section?

You can also test it by commenting out this section and trying again (but if you reference anything, you will get "type or namespace not found" errors).
Hmm, second thought: you are inside a Web Project (as opposed to a web site). While you can use namespaces, you cannot include namespaces that are in the same directory (iirc, but I thought that would only count for web sites).

Third thought: when you placed them inside a namespace, did you use the Public keyword on the classes? And/or did you prefix the calls to members of those classes with the name of the class? When inside the same class you don't need to do that, but if you split one class into two, you need to somehow create instances of the other class and prefix your methods with the name of that local variable.
the3rdmanAuthor Commented:

I have attached an example function within the namespace and then the class & sub class.

All the classes are public.  I had the functions originally as shared functions but then changed them and now create an instance of the class to execute the functions.

I can in theory put this code into a separate project and reference it if that's the resolution.
Namespace DataBlocks

    Public Class ProcessBlock

        Public Class All

            Public Function ProcessErrorNode(ByVal n As XmlNode, Optional ByRef ErrorCode As String = "", _
                    Optional ByRef ErrorDescription As String = "" _
                ) As String

                Dim sRet As String

                For Each n1 As XmlNode In n.ChildNodes
                    Select Case LCase(n1.Name)
                        Case Is = "errorcode"
                            ErrorCode = n1.InnerText
                        Case Is = "errormessage"
                            ErrorDescription = n1.InnerText
                        Case Else
                            ProcessErrorNode(n1, ErrorCode, ErrorDescription) 'test &= "<tr><td colspan='" + n1.ChildNodes.ToString + "'>" + n1.Name + "</td><td>" + n1.InnerText + "</td></tr>"
                    End Select


                sRet = "<tr class='XMLError'><td colspan='2'>Error</td></tr>"
                sRet &= T3M.Format.HTMLFormat.FormatTable("Error Code", ErrorCode, Width:="30%")
                sRet &= T3M.Format.HTMLFormat.FormatTable("Description", ErrorDescription)

                Return sRet

            End Function

        End Class

End Namespace

Open in new window

Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Here's a tip. Splitting one class into multiple classes can be quite a pain. But VB (and C#) supports partial classes. That means, you can create as many files with classes that have the same signature as your current class. Before you started moving your functions around, they were all in one class, which looked like this:

Partial Public Class _Default
    Inherits System.Web.UI.Page

Now, if you get back to the situation you had previously (all functions in one file) and you just add a few class files to the project (right-click "Add Class File") and you copy the above signature (including all the imports!) on top of the default classname that VS creates for you, you can split your functions anyway you like without having to take special measures (as aggregating your classes). You can simply use any function from your current class file into the new class file as long as you use "Partial" in the declaration and use the same name. Don't (yet) use namespaces.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
the3rdmanAuthor Commented:
many thanks, managed to get it working quickly (with the help of search and replace!).

Have another issue now, but will open another ticket for that!
My comment and yours were almost the same time, which is why I missed it, sorry for that. I see now that you have a class inside a class (and there's one missing "end class", but possibly a cut and paste error). Classes inside classes are allowed and are called nested classes, but may be tricky to get right. Normally, nested classes are only used if the nested class is only of use to the containing class.

To cut to the chase: avoid nested classes unless you have a serious design consideration that warrants them.

(meanwhile you accepted my comment and you mentioned, in the grading comment, that it's all working now. Good to hear that!)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.