473,785 Members | 2,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.P age

--" Web Form Designer Generated Code "--
Private Sub Page_Load(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
MyBase.Load

Dim abob As New Bob
Manager.Add(abo b)
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(abo b)
in the form.

Can you tell me what is wrong? Thanks.

Nov 18 '05 #1
4 3183
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*******@yaho o.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.P age

--" Web Form Designer Generated Code "--
Private Sub Page_Load(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
MyBase.Load

Dim abob As New Bob
Manager.Add(abo b)
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(abo b)
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*******@yaho o.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.P age

--" Web Form Designer Generated Code "--
Private Sub Page_Load(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
MyBase.Load

Dim abob As New Bob
Manager.Add(abo b)
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(abo b)
in the form.

Can you tell me what is wrong? Thanks.

.

Nov 18 '05 #3
"Holly Li" <ho*******@yaho o.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*******@yaho o.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*******@yaho o.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.P age

--" Web Form Designer Generated Code "--
Private Sub Page_Load(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
MyBase.Load

Dim abob As New Bob
Manager.Add(abo b)
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(abo b)
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
2220
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 the solution I would like to create a new Windows application project in that solution so that my 2 other projects are not impacted by this third project. Now this new project would contain the startup Form from which I could open my Form in the...
7
3107
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 those parts of the code which are different on desktop and smart device projects 2. How can I actually share the same .cs source code files between the two projects. If I try to open a smart device project and add the files which are in the...
6
2830
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 is the project contains all product info in my Sales project, i added the reference of the Product to Sales project because I need to shows the Product info in my Sales. in the other hand, i also need to show the Sales in my Product. now the
9
5449
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 be able to generate and compile the project on the enviroments where Visual Studio.Net is not installed. Thanks and Regards, Anubhav Jain MTS Persistent Systems Pvt. Ltd. Ph:+91 712 2226900(Off) Extn: 2431 Mob : 094231 07471
3
2199
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 the libraries that we wish to debug to the solution, and make project references to the other projects within the solution. All other library references would be file references, since they were not included in the solution. However, the...
3
1585
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 dll's which my main project needs to run. When i compile a dll project it generates the dll it implements. Then i take that dll and put it in the directoory where my main app executable is. Then i go to my main project and add a reference in it to...
2
4687
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). Project B is the windows forms application that also references C and D. Additionally, C references D and D references C. What is occurring is that project B cannot build telling me that a read-only property is declared in project A which is not...
24
2796
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 menu in each one? I have tried using the DIM statement with .ShowDialog, however, the forms are not recognized as they are listed in seperate projects. Please advise. Thanks, Dr. S.
4
3572
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 projects from my Website. I also have a common set of DLLs I use across all of my applications. It would be great if I could put all of those DLLs into their own projects, and to reference that project from various solutions. The way my solution is...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.