Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB
Hi...
 
Is it possible to use C# and VB in same project, if yes how can i use that. Please help...
 
Nidhin
Posted 17-Jan-10 22:01pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can - for some kind of tasks. Have a look here[^].
 
As is mentioned on that link - "Why would you want to, though"?
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

not possible...
 
But
in one solution
you can take projects in different supported languages
 
Happy Coding!
Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

You can have both C# and VB in the same solution, however you may have complications if you try to make them in the same project file.
 
I have worked through this before in a previous job but you have to watch out for a cicular dependancy that can cause the application to be very dependant on the other.
 
So as it is possible it is not recomended as you can see above.
 
If your having trouble trying to step through the VB portion from the C# being the lead, you have to add the .exe into the C# bin/debug folder so it can work.
 
Hope that helps.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

I'm not 100% sure, but I saw something called "Interlop" that allows you to exchange functions and data between all languages (C#, VB, C++). I'll have to see if I can get more information about it.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

using System;
using System.Drawing;
using System.Windows.Forms;
 
namespace Helper
{
class ControlMover
{
public enum Direction
{
Any,
Horizontal,
Vertical
}
 
public static void Init(Control control)
{
Init(control, Direction.Any);
}
 
public static void Init(Control control, Direction direction)
{
Init(control, control, direction);
}
 
public static void Init(Control control, Control container, Direction direction)
{
bool Dragging = false;
Point DragStart = Point.Empty;
control.MouseDown += delegate(object sender, MouseEventArgs e)
{
Dragging = true;
DragStart = new Point(e.X, e.Y);
control.Capture = true;
};
control.MouseUp += delegate(object sender, MouseEventArgs e)
{
Dragging = false;
control.Capture = false;
};
control.MouseMove += delegate(object sender, MouseEventArgs e)
{
if (Dragging)
{
if (direction != Direction.Vertical)
container.Left = Math.Max(0, e.X + container.Left - DragStart.X);
if (direction != Direction.Horizontal)
container.Top = Math.Max(0, e.Y + container.Top - DragStart.Y);
}
};
}
}
}
  Permalink  
Comments
ProgramFOX at 27-Dec-12 8:35am
   
This is a question from March. Why do you answer to it? The question is solved already.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

AFAIK, it is not. .Net compiles the C# code through csc.exe while the VB.Net code is compiled through vbs.exe. Hence you cannot have C# and VB.Net files in same solution project.
 
Although you can have C# and VB projects in same solution.
 
In case you wish to use VB.Net/C# project in C#/VB.Net, you can add a reference to it in your C#/VB.Net project and then use that.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 9

Hi You have to take one solution of VS and in this Solution you crate two project in different language such as C# and VB...
  Permalink  
Comments
Wes Aday at 3-May-14 9:04am
   
There is absolutely no reason at all to answer a question that is 4 years old and has already been answered.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 410
1 Abhinav S 260
2 Nirav Prabtani 252
3 Andreas Gieriet 155
4 Dave Kreskowiak 155
0 OriginalGriff 7,545
1 Sergey Alexandrovich Kryukov 6,757
2 Maciej Los 3,909
3 Peter Leow 3,693
4 CHill60 2,712


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 3 May 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100