Results 1 to 4 of 4

Thread: [RESOLVED] NameSpaces

  1. #1

    Thread Starter
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336

    Resolved [RESOLVED] NameSpaces

    I am completely confused by namespaces.

    First of all, how do I change the namespace for my overall project. i tried to do it manualy, but then I get tons of errors.

    Secondly, I added a new form and incorperated some of the same "Using" files, and I keep getting errors saying these files are already in use by this namespace.

    Does each form need a different namspace? Or do I only need to declare the imported files in the main form and that is it?

    In other words.. I am getting errors saying that i have already declared Sytem.IO in another form, for example. Is that normal?

    Woah is me....
    Last edited by Arc; Jul 8th, 2007 at 04:01 AM.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  2. #2
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: NameSpaces

    Hi there,

    Here's the little I know:

    You can change your project's default namespace in Project->Properties->Application(tab)

    Each form needs its own using statements. A form is just another class. Each form does not need its own namespace. When you add a new form to your project, you'll see that as a default it gets its own using statements above the namespace and all your code is within your project's default namespace.

    c# Code:
    1. using System;
    2. using System.Collections.Generic;
    3. using System.ComponentModel;
    4. using System.Data;
    5. using System.Drawing;
    6. using System.Text;
    7. using System.Windows.Forms;
    8.  
    9. namespace MyProgram
    10. {
    11.     public partial class Form1 : Form
    12.     {
    13.         public Form1()
    14.         {
    15.             InitializeComponent();
    16.         }
    17.     }
    18. }

    I also think that this is a helpful definition of namespace: http://en.wikipedia.org/wiki/Namespa...puter_science)

    I hope that little helps.

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: NameSpaces

    Note that when you change the namespace of your application you might see a couple of warnings and errors, try to clean and rebuild your project. This will probably eliminate them
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4

    Thread Starter
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336

    Re: NameSpaces

    Thanks guys, I appreciate it.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width