Search:
Namespaces
Discussions
.NET v1.1
Feedback
C# and VB.net project reference each other.
Messages
Related Types
This message was discovered on
microsoft.public.dotnet.framework.aspnet
.
Post a new message to this list...
Holly Li
Hi,
Because of reuse, I need to mix C# project and VB.net
project. To illustrate the problem, I have built 3 simple
projects:
1) C# library--projc (has one class "Manager")
2) vb.net library--projb (has one class "Bob")
3) vb.net web form--projweb (has one web form with a
label on it)
Here are the code:
projc:
using System;
using busivb;
namespace clib
{
public class Manager
{
public Manager()
{
}
public static void Add(Bob bob)
{
bob.Name="hello";
}
}
}
projb:
Namespace busivb
Public Class Bob
Dim _name As String
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal Value As String)
_name = Value
End Set
End Property
End Class
End Namespace
projweb
Imports busivb
Imports clib
Namespace testvbweb
Public Class WebForm1
Inherits System.Web.UI.
Page
--" Web Form Designer Generated Code "--
Private Sub Page_Load(ByVal sender As
System.
Object
, ByVal e As System.EventArgs) Handles
MyBase.Load
Dim abob As New Bob
Manager.Add(abob)
lbName.Text = abob.Name
End Sub
End Class
End Namespace
I got "Reference required to assembly 'busivb' containing
the type 'busivb.Bob'. Add one to your project." error
for the line:
Manager.Add(abob)
in the form.
Can you tell me what is wrong? Thanks.
Reply to this message...
Karl
Did you add a project reference to busivb in both your C# library and your
web form?
karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Holly Li" <
Click here to reveal e-mail address
> wrote in message
news:0a9801c49745$e33b04d0$
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Holly Li
Yes.
I found something on the internet that tells me to use
dlls not projects when mix c# and vb.net together. It
works when I reference c# code using dll in vb.net.
[Original message clipped]
Reply to this message...
Mark Rae
"Holly Li" <
Click here to reveal e-mail address
> wrote in message
news:0b3301c4974c$6af5d160$
Click here to reveal e-mail address
...
[Original message clipped]
For the current version of Visual Studio, but the next version (codename
Whidbey) will allow more than one language per project...
Reply to this message...
Kevin Spencer
> I found something on the internet that tells me to use
I sure am glad I didn't find that on the internet, as I've got tons of
Solutions that contain both VB.Net and C# projects in them. Funny thing is,
they all work fine. Maybe you can't believe everything you read on the
internet?
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"Holly Li" <
Click here to reveal e-mail address
> wrote in message
news:0b3301c4974c$6af5d160$
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
System.EventArgs
System.Object
System.Web.UI.Page
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com