Hi there,
In my project I have 3 folders which represent the 3 tier architecture.(the business layer, data access layer and the presentation layer)
The frmMainMenu is in the presentation layer and in the presentation layer I have other folders that have other forms in it.
When I try to access a form with in the folder in the presentation layer to the frmMainMenu I have to add each package
As
1.
using Admin_Application.PresentationLayer.Proposal_in_Progress;
using Admin_Application.PresentationLayer.Proposals_Submitted;

why dosen’t it allow me to use
2.
using Admin_Application.PresentationLayer.*;
can’t I use it the second way??

thanxxxxxx

why dosen’t it allow me to use
2.
using Admin_Application.PresentationLayer.*;
can’t I use it the second way??

That's just the way the C# language is designed; there is no ' * ' like with Java's import directive.

What you can do, though, is this:

using Admin_Application.PresentationLayer;

Then you can refer to Proposal_in_Progress and Proposals_Submitted directly in your code. If those are classes, then I think this gets you what you want.

Also note: In C#, you're importing a "namespace", not a "package"--nitpicky details, perhaps, but the perspective shift might help: Namespaces have nothing to do with folder structure. The IDEs I use usually create a namespace block that matches folder structure when code files are created, but it's this declaration in the file contents, not its location in the file system, that determine the namespace.

Of possible interest: Comparison of Java and C#

They way it works in .NET you can only use one folder at once and it will always exclude sub folders. You have to import each namespace ("folder") as you would import System.Xml and System.Xml.Linq. The difference between this and java (I guess this is what your referring to for the import x.*)

Java
1. import javax.swing.*; //import package all the classes in .swing
2. import javax.swing.JPanel; //import a single class

C#
1. using System.Windows.Forms; //import the namespace containing all the classes
2. using System.Windows.Forms.Panel; //this is not possible in C# although you can define a variable this way: System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel(); (note that this means you will need to write the complete namespace each time)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.