Solved

Add namespaces to converted vb.net web application project

Posted on 2015-01-08
4
290 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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 NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

932 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now