473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

C# and VB.net project reference each other.

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.

Nov 18 '05 #1
4 3168
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" <ho*******@yahoo.com> wrote in message
news:0a****************************@phx.gbl...
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.

Nov 18 '05 #2
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-----
Did you add a project reference to busivb in both your C# library and yourweb form?

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Holly Li" <ho*******@yahoo.com> wrote in message
news:0a****************************@phx.gbl...
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.

.

Nov 18 '05 #3
"Holly Li" <ho*******@yahoo.com> wrote in message
news:0b****************************@phx.gbl...
I found something on the internet that tells me to use
dlls not projects when mix c# and vb.net together.


For the current version of Visual Studio, but the next version (codename
Whidbey) will allow more than one language per project...
Nov 18 '05 #4
> 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" <ho*******@yahoo.com> wrote in message
news:0b****************************@phx.gbl...
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-----
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" <ho*******@yahoo.com> wrote in message
news:0a****************************@phx.gbl...
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.

.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Gagné | last post by:
Hello, My C# solution is composed of 2 projects, a class library project and a Windows application project. The window in one project calls the DLL in the other. That's ok. Now, to better test...
7
by: Dan | last post by:
I'd like to have a set of more-or-less common code which I want to use for both desktop and smart device projects. I have two questions: 1. How can I set up conditional compile directives for...
6
by: liu | last post by:
Hi all, in my vb.net solution, i have 3 project: 1. Main-this is the startup or the base of my window application. 2. Sales-this is the project that contains all the sales info 3. Product-this...
9
by: Anubhav Jain | last post by:
Hi, I am having few .net source files(.cs or .vb) and I want to dynamically generate the corresponding .net project file(.csproj or .vbproj) for them without using visual studio.So that I could...
3
by: Jerad Rose | last post by:
This is regarding Visual Studio 2003 (framework 1.1). We have several projects/libraries. Of course, many of these reference each other. If we only had one solution, we would simply add all of...
3
by: eduwushu | last post by:
Hi there. Im developing a c# app and i have a solution with some projects: the main project which generates the executable file and some other projects which some of them im compiling generate...
2
by: AMDRIT | last post by:
Hello Everyone, I am having an issue with my solution and hoping that you all can suggest a resolution. I have a common library that (A) that three other projects make reference of (B,C,D). ...
24
by: =?Utf-8?B?RHIuIFMu?= | last post by:
I am incorporating three existing programs into a new "all in one" program. I have added the three projects to the new all in one project. How do I instruct the new initial menu to launch the main...
4
by: | last post by:
I have learned about compartmentalizing my code base using Class Libraries. I have my common code such as my ORM framework broken out into their own Class Libraries, which are referenced as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.