Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Getting StartedGetting Startedusing vb class in c# class wonusing vb class in c# class won't work
Previous
 
Next
New Post
7/1/2010 10:45 AM
 
I am using DotNetNuke 04.08.04
I have modules both in c# and in vb.

to be able to use the c# files in my vb.net dotnetnuke site, the app code folders for the c# modules are registered in the web.config like this:
<codeSubDirectories>
           <add directoryName="Test"/>
 </codeSubDirectories>

All my files (vb and c#) are under the same namespace

file a.vb in folder App_Code/A/
> namespace Test.Modules.A
contains public class "TestA"

file b.cs in folder App_Code/B/
> namespace Test.Modules.B
contains public class "TestB"

When I add the following to my a.vb file:
Imports Test.Modules.B
This works perfectly and I can use what I need form the c# class from in my vb file

When I add the following to my b.cs file:
using Test.Modules.A > this will not work, A is not recognized and it won't compile becuase supposedly there is no "A" in Test.Modules
I can add using Test.Modules, but I can't use A

If I add a c.vb file with the same namespace and I Import Test.Modules.A, this works fine, but it won't from out a cs file.
Other classes from other .cs files I can also use from other .cs files.



What is it that I need to do before being able to use A in my c# files?
 
New Post
7/1/2010 11:20 AM
 
Forgot to add that the problem is only there for the files/classes in the App_Code folder.
I don't have this problem from my DesktopModules folder, so I guess it has to be related to the web.config registering of the folder names
 
New Post
7/1/2010 11:28 AM
 
Hi Steven,

I'm a C# developer myself so this is a bit of a guess, but with VB is there such a thing as a 'default namespace', possibly in an AssemblyInfo.vb file, or a properties dialog somewhere?

Can you browse your VB class in the VS Object Browser and confirm it's in the right namespace?

Good luck,
Rhys

www.rmjcs.com - Mostly SQL Server Stuff
 
New Post
7/2/2010 3:51 AM
 
Hey Rhys,

Thanks for the suggestions. You can add default namespaces to the web.config file but they serve only in aspx pages themselves (where I don't have the problem), for code behind and classes you still have to declare the namespace yourself explicitly which is not workin (using vbclass in my c# class)

As for the object browser, yes everything is available there.

PS. @DNN admin: the quick reply box does not save "hard enters" when quick replying a message..
 
New Post
7/2/2010 4:14 AM
 
I can't edit my firs post anymore but here is a simple sample web app where you can see my problem > the B.cs file contains the line that won't compile in comments.
http://www.delta-visions.net/shares/T...
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting Startedusing vb class in c# class wonusing vb class in c# class won't work


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out