Define a NameSpace in VB

user10962741

I want to define a unified namespace for all my classes and put them all in it. I did it with

Namespace
...
End Namespace

But now I can not import it in other projects, also I can not import it in another file in my main project (That file is not in my namespace it is just UI).

Thank you in andvance !

Meta-Knight

Your project has a root namespace defined in the project properties. Let's say this root namespace is MyApp.MyProject.

Then inside this project, you have a class defined like this:

Namespace MyNamespace

    Public Class MyClass...

End Namespace

If you want to use MyClass inside another class, you would just add the following Imports statement at the top of the file:

Imports MyApp.MyProject.MyNamespace

You could also define a Namespace globally outside of the root namespace of your project with Global like so:

Namespace Global.MyNamespace
    ...
End Namespace

More information can be found in the .NET documentation

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Force rdflib to define a namespace

Missing My namespace in Roslyn VB.NET

Define all external JavaScript in a pre-existing namespace

Define C# class outside of any namespace

How to define namespace in python?

Why does "#define A" interfere with "namespace A{}"?

How to define a reusable function in vue component namespace

Define a QObject derived class inside an anonymous namespace?

How to define a friend operator declared on a template in a namespace?

Declare and define inside namespace - Not sure if it works because it's correct or by accident

Is it possible to programmatically define a new function in a given namespace?

Cannot define namespace variable which was defined globally TCL

Define values for each namespace

Declare variable in namespace, define it in main, make it visible to all other files

Replace string into define variable in VB6

Blazor: Define namespace in Razor File

Can you define a class static constant at namespace scope with auto?

How do I define a variable in a namespace with "using namespace"?

Best way to define obj constructor in namespace javascript

Use cell reference to define array in VB

How to define functions and data from another namespace, not in the global one?

How to define/declare xaml namespace in WPF?

XSLT- Pre Define NameSpace

Define ListenerContainer without the jms namespace in spring jms

How to define data types directly in a namespace

How to define custom namespace and tag alias using camel-xstream

Rust define new Uuid namespace

Using define directive to get the namespace name

How to define namespace name same as return type of function in that namespace?