madinewala

madinewala

  • NA
  • 164
  • 0

using VB.NET classes in C#

Oct 21 2003 4:03 AM
hi there, I have a vb.net project - a DLL project to be precise.. I read in the .NET documentation that I could have a class in any of the .NET languages and use/derive them in other .NET languages.. i.e, I could have a class in vb.net and I could use it in C#, derive a new class from it in c#.. Now, as mentioned earlier, I've got a vb.net project, a DLL. In order to eliminate a VB.NET DLL, I am trying to use the same Vb.net class within my C# project. But I don't know how that would be accomplished. I guess there is no need of creating a new assembly for the vb.net class. I just said "add an existing item" and added the vb.net class(.vb) file into my C#. also, the c# and vb.net classes have the same namespace defined. here's the code I use. vb.NET Namespace MyNamespace Public Class CVB Public Sub CVB() End Sub Function vbFun(ByVal name As String) As String vbFun = name.ToUpper() End Function End Class End Namespace code for C# using System; namespace MyNamespace { /// /// Summary description for Class1. /// public class CClass { public CClass() { // // TODO: Add constructor logic here // } public string myMethod() { CVB cc = new CVB(); return cc.vbFun("irfan"); } } } Here CVB is my vb class, and I'm unable to view it from C#.. any guesses, links, help... wud be beneficial.. TIA irfan

Answers (5)