473,387 Members | 2,436 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,387 software developers and data experts.

Adding C#-Code to VB-Project in VS 2005 without using DLL

Hello

Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
Normally I creating a DLL and importing that from the VB-Project.

But as I am coding something for a Smart Device (PocketPC), I dont want to
distribute multiple files, I'd like to distribute a single EXE file.

I've learned that I can, since VS 2005, add C#-Code to a VB Project.
I can add it, but not use it. What am I doing wrong?

Thanks

Sven
Feb 19 '07 #1
17 3803
Seeing as how you have learned that you can, since VS 2005, add C#-Code to a
VB Project, would you please be so kind as to enlighten us. We would be most
interested.
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:eS****************@TK2MSFTNGP06.phx.gbl...
Hello

Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
Normally I creating a DLL and importing that from the VB-Project.

But as I am coding something for a Smart Device (PocketPC), I dont want to
distribute multiple files, I'd like to distribute a single EXE file.

I've learned that I can, since VS 2005, add C#-Code to a VB Project.
I can add it, but not use it. What am I doing wrong?

Thanks

Sven
Feb 19 '07 #2
Hi Stephany

An Expert from experts-exchange.com told me so, but I cannot get it to
work...

Sven
"Stephany Young" <noone@localhostschrieb im Newsbeitrag
news:Ok**************@TK2MSFTNGP05.phx.gbl...
Seeing as how you have learned that you can, since VS 2005, add C#-Code to
a VB Project, would you please be so kind as to enlighten us. We would be
most interested.
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:eS****************@TK2MSFTNGP06.phx.gbl...
>Hello

Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
Normally I creating a DLL and importing that from the VB-Project.

But as I am coding something for a Smart Device (PocketPC), I dont want
to distribute multiple files, I'd like to distribute a single EXE file.

I've learned that I can, since VS 2005, add C#-Code to a VB Project.
I can add it, but not use it. What am I doing wrong?

Thanks

Sven

Feb 19 '07 #3
Now why does that not surprise me.

Not much of an expert was he?
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:O%***************@TK2MSFTNGP05.phx.gbl...
Hi Stephany

An Expert from experts-exchange.com told me so, but I cannot get it to
work...

Sven
"Stephany Young" <noone@localhostschrieb im Newsbeitrag
news:Ok**************@TK2MSFTNGP05.phx.gbl...
>Seeing as how you have learned that you can, since VS 2005, add C#-Code
to a VB Project, would you please be so kind as to enlighten us. We would
be most interested.
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:eS****************@TK2MSFTNGP06.phx.gbl...
>>Hello

Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
Normally I creating a DLL and importing that from the VB-Project.

But as I am coding something for a Smart Device (PocketPC), I dont want
to distribute multiple files, I'd like to distribute a single EXE file.

I've learned that I can, since VS 2005, add C#-Code to a VB Project.
I can add it, but not use it. What am I doing wrong?

Thanks

Sven

Feb 19 '07 #4
So, what did he ACTUALLY tell you?
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:u0**************@TK2MSFTNGP06.phx.gbl...
Actually he's the #1 ranked there :-)
But it's possible that I have misunderstood his answer...
"Stephany Young" <noone@localhostschrieb im Newsbeitrag
news:ed**************@TK2MSFTNGP05.phx.gbl...
>Now why does that not surprise me.

Not much of an expert was he?
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:O%***************@TK2MSFTNGP05.phx.gbl...
>>Hi Stephany

An Expert from experts-exchange.com told me so, but I cannot get it to
work...

Sven
"Stephany Young" <noone@localhostschrieb im Newsbeitrag
news:Ok**************@TK2MSFTNGP05.phx.gbl...
Seeing as how you have learned that you can, since VS 2005, add C#-Code
to a VB Project, would you please be so kind as to enlighten us. We
would be most interested.
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:eS****************@TK2MSFTNGP06.phx.gbl. ..
Hello
>
Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
Normally I creating a DLL and importing that from the VB-Project.
>
But as I am coding something for a Smart Device (PocketPC), I dont
want to distribute multiple files, I'd like to distribute a single EXE
file.
>
I've learned that I can, since VS 2005, add C#-Code to a VB Project.
I can add it, but not use it. What am I doing wrong?
>
Thanks
>
Sven
>

Feb 19 '07 #5
Actually he's the #1 ranked there :-)
But it's possible that I have misunderstood his answer...
"Stephany Young" <noone@localhostschrieb im Newsbeitrag
news:ed**************@TK2MSFTNGP05.phx.gbl...
Now why does that not surprise me.

Not much of an expert was he?
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:O%***************@TK2MSFTNGP05.phx.gbl...
>Hi Stephany

An Expert from experts-exchange.com told me so, but I cannot get it to
work...

Sven
"Stephany Young" <noone@localhostschrieb im Newsbeitrag
news:Ok**************@TK2MSFTNGP05.phx.gbl...
>>Seeing as how you have learned that you can, since VS 2005, add C#-Code
to a VB Project, would you please be so kind as to enlighten us. We
would be most interested.
"Sven Rutten" <sven (at) ruttensoft.comwrote in message
news:eS****************@TK2MSFTNGP06.phx.gbl.. .
Hello

Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
Normally I creating a DLL and importing that from the VB-Project.

But as I am coding something for a Smart Device (PocketPC), I dont want
to distribute multiple files, I'd like to distribute a single EXE file.

I've learned that I can, since VS 2005, add C#-Code to a VB Project.
I can add it, but not use it. What am I doing wrong?

Thanks

Sven



Feb 19 '07 #6
"Stephany Young" <noone@localhostschrieb:
Seeing as how you have learned that you can, since VS 2005, add C#-Code to
a VB Project, would you please be so kind as to enlighten us. We would be
most interested.
You actually cannot, except in Web projects in which you can use different
languages in different script blocks and pages.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 19 '07 #7
"Stephany Young" <noone@localhostschrieb im Newsbeitrag
news:u0**************@TK2MSFTNGP04.phx.gbl...
So, what did he ACTUALLY tell you?
Well, maybe he was told that "it's possible to add C# code to a VB 2005
project", which is basically not wrong but on the other must not be
generalized.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 19 '07 #8
Can't you have a solution that has multiple projects, and the projects can
be in different languages?

Robin S.
------------------------------------
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:Oc**************@TK2MSFTNGP06.phx.gbl...
"Stephany Young" <noone@localhostschrieb:
>Seeing as how you have learned that you can, since VS 2005, add C#-Code
to a VB Project, would you please be so kind as to enlighten us. We
would be most interested.

You actually cannot, except in Web projects in which you can use
different languages in different script blocks and pages.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 19 '07 #9
You're right it must not be generalised.

Until the OP tells us what he was told we cannot determine if it was right,
wrong or indifferent.
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
"Stephany Young" <noone@localhostschrieb im Newsbeitrag
news:u0**************@TK2MSFTNGP04.phx.gbl...
>So, what did he ACTUALLY tell you?

Well, maybe he was told that "it's possible to add C# code to a VB 2005
project", which is basically not wrong but on the other must not be
generalized.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Feb 19 '07 #10
Yes, of course you can. But references to the projects at design-time are
really 'smart' references to the compiled assemblies of those projects, in
that they know what and where the assenblies will be when thay are compiled.
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:y9******************************@comcast.com. ..
Can't you have a solution that has multiple projects, and the projects can
be in different languages?

Robin S.
------------------------------------
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:Oc**************@TK2MSFTNGP06.phx.gbl...
>"Stephany Young" <noone@localhostschrieb:
>>Seeing as how you have learned that you can, since VS 2005, add C#-Code
to a VB Project, would you please be so kind as to enlighten us. We
would be most interested.

You actually cannot, except in Web projects in which you can use
different languages in different script blocks and pages.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 19 '07 #11
BK
Although I'm not an expert, I do have a simple solution for you. Add
the C# code to it's own assembly class, compile the dll as you stated
you were already familiar with, and then use ILMerger to merge the 2
assemblies (the VB and C# outputs) into one final assembly.

Feb 19 '07 #12
I know this is slightly off topic, but I'm curious - since both vb and
c# compile to msil, why couldn't the ide use a preprocessor to support
different languages in the same file?

Something like:

#Visual Basic
Public Sub VBFoo()
...
End Sub
#End Visual Basic

#CSharp
public void CSharpFoo( )
{
...
}
#End CSharp

Thanks,

Seth Rowe
On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
"Stephany Young" <noone@localhostschrieb:
Seeing as how you have learned that you can, since VS 2005, add C#-Code to
a VB Project, would you please be so kind as to enlighten us. We would be
most interested.

You actually cannot, except in Web projects in which you can use different
languages in different script blocks and pages.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 19 '07 #13
C# was never invented.

that is the best strategy; make those C# dorks use a real language.


On Feb 19, 3:29 am, "Sven Rutten" <sven (at) ruttensoft.comwrote:
Hello

Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
Normally I creating a DLL and importing that from the VB-Project.

But as I am coding something for a Smart Device (PocketPC), I dont want to
distribute multiple files, I'd like to distribute a single EXE file.

I've learned that I can, since VS 2005, add C#-Code to a VB Project.
I can add it, but not use it. What am I doing wrong?

Thanks

Sven

Feb 19 '07 #14
Seth,

Why don't you submit this to MS. This, at least on the surface, sounds like
a good idea.

Mike Ober.

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11*********************@p10g2000cwp.googlegro ups.com...
>I know this is slightly off topic, but I'm curious - since both vb and
c# compile to msil, why couldn't the ide use a preprocessor to support
different languages in the same file?

Something like:

#Visual Basic
Public Sub VBFoo()
...
End Sub
#End Visual Basic

#CSharp
public void CSharpFoo( )
{
...
}
#End CSharp

Thanks,

Seth Rowe
On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
>"Stephany Young" <noone@localhostschrieb:
Seeing as how you have learned that you can, since VS 2005, add C#-Code
to
a VB Project, would you please be so kind as to enlighten us. We would
be
most interested.

You actually cannot, except in Web projects in which you can use
different
languages in different script blocks and pages.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Feb 19 '07 #15
Now there's a question and a half Seth :)

Have you finished the preprocessor yet? :)

How would you envisage it resolving something like:

#Visual Basic

Public Class Foo

#End Visual Basic

#Visual Basic

Public X As Integer

Public Sub VBFoo

x += 1

End Sub

#End Visual Basic

#CSharp

public int x;

public void CSharpFoo()
{
x++;
}

#CSharp

#Visual Basic

End Class

#End Visual Basic

In VB.NET, variable names are case-insensitive, so, logically the dummy
would be spat because VB.Net can;t handle 2 variables with the same name
having the same scope.

In C#, however, variable names are case-sensitive, so, X and x declared
having the same scope is perfectly legal.

The point here is that such a preprocessor, to be of any value would need to
break the rules of one language to allow the rules of the other language,
and, immediately, that need negates any value that such a preprocessor might
have.
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11*********************@p10g2000cwp.googlegro ups.com...
>I know this is slightly off topic, but I'm curious - since both vb and
c# compile to msil, why couldn't the ide use a preprocessor to support
different languages in the same file?

Something like:

#Visual Basic
Public Sub VBFoo()
...
End Sub
#End Visual Basic

#CSharp
public void CSharpFoo( )
{
...
}
#End CSharp

Thanks,

Seth Rowe
On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
>"Stephany Young" <noone@localhostschrieb:
Seeing as how you have learned that you can, since VS 2005, add C#-Code
to
a VB Project, would you please be so kind as to enlighten us. We would
be
most interested.

You actually cannot, except in Web projects in which you can use
different
languages in different script blocks and pages.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 19 '07 #16
Now there's a question and a half Seth :)
>
Have you finished the preprocessor yet? :)
Finished? I haven't even started! (and probably won't)

:-)
How would you envisage it resolving something like:
<snip>

Good point Stephany, I didn't really think it through - it was just a
thought that I had while reading this thread. Perhaps a class level
attribute that declares the entire class contents in a certain
language would resolve these issues, but that kind of defeats the
purpose (not to mention the "coolness" factor) doesn't it?.

By the way, how exactly would one find how to go about writing
something like this? Also, unless you rewrite the ide you would
probably lose intellisense and many other special features/keywords,
not to mention the error checking.

Thanks,

Seth Rowe
On Feb 19, 4:36 pm, "Stephany Young" <noone@localhostwrote:
Now there's a question and a half Seth :)

Have you finished the preprocessor yet? :)

How would you envisage it resolving something like:

#Visual Basic

Public Class Foo

#End Visual Basic

#Visual Basic

Public X As Integer

Public Sub VBFoo

x += 1

End Sub

#End Visual Basic

#CSharp

public int x;

public void CSharpFoo()
{
x++;
}

#CSharp

#Visual Basic

End Class

#End Visual Basic

In VB.NET, variable names are case-insensitive, so, logically the dummy
would be spat because VB.Net can;t handle 2 variables with the same name
having the same scope.

In C#, however, variable names are case-sensitive, so, X and x declared
having the same scope is perfectly legal.

The point here is that such a preprocessor, to be of any value would need to
break the rules of one language to allow the rules of the other language,
and, immediately, that need negates any value that such a preprocessor might
have.

"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11*********************@p10g2000cwp.googlegro ups.com...


I know this is slightly off topic, but I'm curious - since both vb and
c# compile to msil, why couldn't the ide use a preprocessor to support
different languages in the same file?
Something like:
#Visual Basic
Public Sub VBFoo()
...
End Sub
#End Visual Basic
#CSharp
public void CSharpFoo( )
{
...
}
#End CSharp
Thanks,
Seth Rowe
On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
"Stephany Young" <noone@localhostschrieb:
Seeing as how you have learned that you can, since VS 2005, add C#-Code
to
a VB Project, would you please be so kind as to enlighten us. We would
be
most interested.
You actually cannot, except in Web projects in which you can use
different
languages in different script blocks and pages.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 20 '07 #17
I just reccomend using Dreamweaver; and a single language

Avoid unnecessary complexities.

C# was _NEVER_INVENTED_ that is my strategy
until MS takes VB seriously they can lick my nuts


On Feb 19, 4:41 pm, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
Now there's a question and a half Seth :)
Have you finished the preprocessor yet? :)

Finished? I haven't even started! (and probably won't)

:-)
How would you envisage it resolving something like:

<snip>

Good point Stephany, I didn't really think it through - it was just a
thought that I had while reading this thread. Perhaps a class level
attribute that declares the entire class contents in a certain
language would resolve these issues, but that kind of defeats the
purpose (not to mention the "coolness" factor) doesn't it?.

By the way, how exactly would one find how to go about writing
something like this? Also, unless you rewrite the ide you would
probably lose intellisense and many other special features/keywords,
not to mention the error checking.

Thanks,

Seth Rowe

On Feb 19, 4:36 pm, "Stephany Young" <noone@localhostwrote:
Now there's a question and a half Seth :)
Have you finished the preprocessor yet? :)
How would you envisage it resolving something like:
#Visual Basic
Public Class Foo
#End Visual Basic
#Visual Basic
Public X As Integer
Public Sub VBFoo
x += 1
End Sub
#End Visual Basic
#CSharp
public int x;
public void CSharpFoo()
{
x++;
}
#CSharp
#Visual Basic
End Class
#End Visual Basic
In VB.NET, variable names are case-insensitive, so, logically the dummy
would be spat because VB.Net can;t handle 2 variables with the same name
having the same scope.
In C#, however, variable names are case-sensitive, so, X and x declared
having the same scope is perfectly legal.
The point here is that such a preprocessor, to be of any value would need to
break the rules of one language to allow the rules of the other language,
and, immediately, that need negates any value that such a preprocessor might
have.
"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message
news:11*********************@p10g2000cwp.googlegro ups.com...
>I know this is slightly off topic, but I'm curious - since both vb and
c# compile to msil, why couldn't the ide use a preprocessor to support
different languages in the same file?
Something like:
#Visual Basic
Public Sub VBFoo()
...
End Sub
#End Visual Basic
#CSharp
public void CSharpFoo( )
{
...
}
#End CSharp
Thanks,
Seth Rowe
On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
>"Stephany Young" <noone@localhostschrieb:
Seeing as how you have learned that you can, since VS 2005, add C#-Code
to
a VB Project, would you please be so kind as to enlighten us. We would
be
most interested.
>You actually cannot, except in Web projects in which you can use
>different
>languages in different script blocks and pages.
>--
> M S Herfried K. Wagner
>M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>- Hide quoted text -

- Show quoted text -

Feb 20 '07 #18

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

Similar topics

6
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1...
4
by: Tonya | last post by:
Hi, Does anyone know how i can add controls to a progress bar. I have searched the internet but could not find any examples. what i want to add is a progress bar and a button. thx
10
by: sp0 | last post by:
Is there a reason why to make mix numbers improper when adding? It seems when subtracting and adding, adding a subtracting the whole numbers and fraction parts should be sufficient? what'ch think
5
by: Paul | last post by:
Hi I have a table that currently has 466 columns and about 700,000 records. Adding a new DEFAULT column to this table takes a long time. It it a lot faster to recreate the table with the new...
2
by: Chris Cobb | last post by:
I have a table that currently contains 718000 rows. I wish to add a column to the table. Adding this column anywhere other than the end of the table requires exporting data, a drop and recreate,...
2
by: avivgur | last post by:
Hello, I am writing a program in Visual C# and I have encountered a problem. In my program I want to dynamically create a multitude of controls (thousands) on a form. The problem is that calling...
5
by: yawnmoth | last post by:
I'm having some difficulty with adding elements to a webpage via the DOM. The following works: main.htm: <script> js = document.createElement('script'); js.src='test.js';...
9
by: Kadett | last post by:
Hi all, I have following problem: I'm creating a ListView (Details) control at run-time and filling it with some records (let's say 10 000). This operation seems to be quite fast, but when I call...
3
by: Jx4 | last post by:
Hi there, I am currently having trouble with some issues with adding Currency values. I have one column with values of transactions and the other column has a running total. It works great...
6
by: santiago | last post by:
I guess one cannot do this: arraytot = arraytot + arraydet; So, what's the trick to adding arrays like this? Thanks.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.