Classes [modified]
-
Hi.i am C# beginner,i have created two folders for my project so other folder is for classes and the other one is for my forms so i am trying to use my classes from another folder but i can't see them.
-
Hi.i am C# beginner,i have created two folders for my project so other folder is for classes and the other one is for my forms so i am trying to use my classes from another folder but i can't see them.
What do you mean you can't see them? Make sure of the the namespace for the classes.
-
Hi.i am C# beginner,i have created two folders for my project so other folder is for classes and the other one is for my forms so i am trying to use my classes from another folder but i can't see them.
Mamphekgo wrote:
so other folder is for classes and the other one is for my forms
You do realise that Forms are just classes?
Mamphekgo wrote:
am trying to use my classes from another folder but i can't see them
Make sure their are either all in the same namespace, or that you put a
using namespace;
line at the top of the file.
Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog
-
Hi.i am C# beginner,i have created two folders for my project so other folder is for classes and the other one is for my forms so i am trying to use my classes from another folder but i can't see them.
When you create a folder and then create a class inside it, Studio appends the folder to the default namespace i.e.
Project.Folder
. That's why they likely have different namespaces. Change the namespaces or useusing
statements as mentioned above.
Try code model generation tools at BoneSoft.com.
-
Hi.i am C# beginner,i have created two folders for my project so other folder is for classes and the other one is for my forms so i am trying to use my classes from another folder but i can't see them.
I'm really piggybacking on what everyone else has said, but I had this issue when I started coding as well, and a visual image helped me out. Basically, think of it as a tree. Unless you provide links across the branches(using *), all you can reference is what's above you. --Project1 --Class1 --Class2 --Project2 --Form1 --Form2 You need to do one of two things: Edit the namespace for each project (can be done through project->properties). Chaning it this way should recursively edit the namespaces of your files. (It does in VS.Net 2005) or add "using Project2;" to Project1's classes, and "using Project1;" to Project2's classes.
-
I'm really piggybacking on what everyone else has said, but I had this issue when I started coding as well, and a visual image helped me out. Basically, think of it as a tree. Unless you provide links across the branches(using *), all you can reference is what's above you. --Project1 --Class1 --Class2 --Project2 --Form1 --Form2 You need to do one of two things: Edit the namespace for each project (can be done through project->properties). Chaning it this way should recursively edit the namespaces of your files. (It does in VS.Net 2005) or add "using Project2;" to Project1's classes, and "using Project1;" to Project2's classes.