Noob wants to work with multiple code files

I'm an msaccess programmer stepping up to C# in visual studio. I have a huge MsAccess app which I want to convert. Because of the size of my app, one of the things I need to work out is how work with multiple program files. So i was wondering if someone can give me an example of how to build my app in multiple files, and how to call functions which are not within the same file?
TownTalkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
You should read up Namespace.

A small project may have one namespace only, and your classes can be spread over as many separate files you prefer.
A larger project may have more namespaces. These are separated, but you can easily refer to classes in other namespaces either by the using directive or the full name: namespace.someclass. Brief intro is here:

http://www.dotnetperls.com/namespace

If you convert to a Winforms application, each form will have its own set of files. That's a good starting point. But, for example, if you will have classes not related to one form only, you should move these to separate cs files.

/gustav
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
In Access you have a form with code (or macros - yeuch) doing things.  In C# you have a form with a file contianing the code doing things.  Pretty similar.
In Access you have different modules.  In C# you have classes, each in their own file.  Again pretty similar.

In Visual studio when you add a new form or new class via the wizard the supporting files are generated for you - you don't need to do anything about the overall structure of where files are....
0
TownTalkAuthor Commented:
Yes I certainly need to get a grasp of namespaces. But I think the example you cited has something relevant in it:

If file1.cs has a function which needs to call another function in file2.cs... Am I correct in assuming that I need to put a 'using' statement at the top of file1.cs to reference the namespace in file2.cs? That's what I was trying to ask in my original post.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Gustav BrockCIOCommented:
No. Not if the files and their classes specify the same namespace.

/gustav
0
TownTalkAuthor Commented:
OK thanks guys. I got managed to call a function in another .cs file. This will get me started.
0
AndyAinscowFreelance programmer / ConsultantCommented:
Just an aside
>>I have a huge MsAccess app which I want to convert.
That will probably be a lot more work than you anticipate - but it is doable.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.