Solved

Add namespaces to converted vb.net web application project

Posted on 2015-01-08
4
293 Views
Last Modified: 2015-01-11
I'm refreshing a vb.net website in VS2013, and experimenting with converting it to a web application.  I've done all the steps of the conversion except adding namespaces to the code files.  There are maybe 150 to 200 code classes in roughly as many module and codebehind files.  

What are some ways to put all this code into a single namespace?

And will I have to change all the class.method calls to include that namespace? That is:

    dim exeG as new GetVars
    rtn = exeG.GetFirstVar(n)

would have to be

    dim exeG as new MyNameSpace.GetVars
    rtn = exe.GetFirstVar(n)

or if public shared,

    rtn = MyNameSpace.GetVars.GetFirstVar(n)

Because that might be more work than the conversion to web application would be worth, given time and budget constraints.
0
Comment
Question by:codequest
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
Imran Javed Zia earned 500 total points
ID: 40539740
Hi,

I don't remember any automatic way to perform this action. but you can Put the namespace under "Default Namespace" in project properties, and it doesn't need to be in the code files.

but for maintainability and readability I will recommend you to do it in each file.

Thanks
0
 
LVL 2

Author Comment

by:codequest
ID: 40540994
Thanks for the input.  I think that's on the right track.  However, it still generates a many errors of these types:

'MPMenu' is not declared. It may be inaccessible due to its protection level.      
'MsgBox' is not a member of 'WebApplication1.App_Pages_blah_blah

These errors all seem to appear in the CodeBehind files, not in the class modules.  Also, these errors seem to be limited to some, but not all, ascx user controls + aspx files that have master files.

Any suggestions about those?  If not, I may accept your answer and ask another question.
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
ID: 40542844
You may have to cross check deginer.cs files.
0
 
LVL 2

Author Comment

by:codequest
ID: 40543586
Thanks for the suggestion.  Can you elaborate on that?  I've never worked with the designer files before.  

There appear to be only a few code behind files affected, so if can resolve those, I'll be able to test the rest of the functionality for website vs web application.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question