473,320 Members | 1,868 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,320 software developers and data experts.

Access VB class through C#

rrocket
116 100+
Is it even possible to access a VB class through a C# page? I need to pass two values to a VB function and or class (it is a 3rd party thing) from a C# page and have it return a value... Any examples and/or references to sites would be appreciated.
Dec 19 '07 #1
5 5266
Frinavale
9,735 Expert Mod 8TB
Is it even possible to access a VB class through a C# page? I need to pass two values to a VB function and or class (it is a 3rd party thing) from a C# page and have it return a value... Any examples and/or references to sites would be appreciated.
Include the VB Class library that contains the class into your project that you wish to use in your C# code. Then declare an instance of this class as you normally would declare an instance of an object.

-Frinny
Dec 19 '07 #2
rrocket
116 100+
When I add the class to the App_Code folder I get this error:
The files '/Dev/App_Code/GetMiles.vb' and '/Dev/App_Code/GetCityState.cs' use a different language, which is not allowed since they need to be compiled together.

Is there a certain way I have to add the VB class to the project?
Dec 19 '07 #3
Frinavale
9,735 Expert Mod 8TB
When I add the class to the App_Code folder I get this error:
The files '/Dev/App_Code/GetMiles.vb' and '/Dev/App_Code/GetCityState.cs' use a different language, which is not allowed since they need to be compiled together.

Is there a certain way I have to add the VB class to the project?
I don't think that you can add the VB Class to your C# project in this manner.
You should add a reference to the DLL of that compiled class.

Compile your VB.NET project for that class to create the DLL.
Then add a Reference to that DLL in your C# project.
Dec 19 '07 #4
rrocket
116 100+
I am not sure how to pull that off. All of the examples that I have found are for apps not web.

Can you give me an example and/or point me to a reference that has the information?
Dec 19 '07 #5
Frinavale
9,735 Expert Mod 8TB
I am not sure how to pull that off. All of the examples that I have found are for apps not web.

Can you give me an example and/or point me to a reference that has the information?
Ok...,
  • Create a new project. One that is for a VB.NET Class Library.
  • Give the project a name that is appropriate.
  • Add the VB.NET class to this project.
  • Build this project.
  • In your C# project, add a reference to the DLL that was produced when you built the VB.NET Class Library project.
  • Use the class found within the DLL.
Dec 19 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kevin Saff | last post by:
Apparently I'm missing something. Stroustrup (15.3) says of protected access: If is protected, its name can be used only by member functions and friends of the class in which it is declared...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
8
by: CoolPint | last post by:
I read in books that nested class cannot access private members of nesting class and vice versa unless they are made friends. Somehow, my compiler is letting my nested class member functions access...
9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
1
by: Dave | last post by:
Hello NG, Regarding access-declarations and member using-declarations as used to change the access level of an inherited base member... Two things need to be considered when determining an...
9
by: MacDermott | last post by:
I have an Access MDB which instantiates a class in a custom DLL, manipulates it for a while, then sets it equal nothing. The MDB does other things,too, and generally behaves itself as desired....
3
by: Samuel Burri | last post by:
Hi there I got a simple problem. As you can see in the posted source, I have two classes, where one is derived from the other. In fact, they also contain virtual functions. In the function...
15
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I met with a strange issue that derived class function can not access base class's protected member. Do you know why? Here is the error message and code. error C2248:...
7
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using...
2
by: fgh.vbn.rty | last post by:
Hi, I'm not sure if i'm asking the question correctly but anyway here it is. Say I have 3 classes - class A, class B, class R. 1) A and B are the building blocks and R is like a repository...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.