Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Classes [modified]

Classes [modified]

Scheduled Pinned Locked Moved C#
csharplearning
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mamphekgo
    wrote on last edited by
    #1

    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.

    M N C B D 5 Replies Last reply
    0
    • M Mamphekgo

      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.

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      You have to devine your namespaces. using xxx.Yourfoldername; All the best, Martin

      1 Reply Last reply
      0
      • M Mamphekgo

        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.

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        What do you mean you can't see them? Make sure of the the namespace for the classes.

        1 Reply Last reply
        0
        • M Mamphekgo

          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.

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • M Mamphekgo

            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.

            B Offline
            B Offline
            BoneSoft
            wrote on last edited by
            #5

            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 use using statements as mentioned above.


            Try code model generation tools at BoneSoft.com.

            1 Reply Last reply
            0
            • M Mamphekgo

              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.

              D Offline
              D Offline
              Drew McGhie
              wrote on last edited by
              #6

              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.

              M 1 Reply Last reply
              0
              • D Drew McGhie

                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.

                M Offline
                M Offline
                Mamphekgo
                wrote on last edited by
                #7

                thanx.i got it right now

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups