.NETGURU
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




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification