从VB.Net调用C# [英] Calling C# from VB.Net

查看:72
本文介绍了从VB.Net调用C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我在C#文件中有代码,我想从VB

DotNet表单中调用该类。代码来自
http://www.dnzone。 COM / ShowDetail.asp?NewSID的= 223 。我更像是一个Delphi和

网页开发者。


我尝试过使用Imports但是在做点运算符时没有出现

的事情。


感谢您的帮助!!!

Kevin

解决方案

您首先必须在自己的项目中将C#代码构建为* .dll文件并且

然后你在调用VB.NET项目中设置对它的引用。你不能在同一个项目中使用

不同的语言。


" ke ************* @ state.or &页面没有自动跳转QUOT; <柯*************** @ state.or.us>写在

消息新闻:uM ************** @ TK2MSFTNGP12.phx.gbl ...

你好,
我在C#文件中有代码,我想从VB
DotNet表单中调用该类。代码来自
http://www.dnzone。 COM / ShowDetail.asp?NewSID的= 223 。我更像是一个Delphi
和网络开发者。

我尝试使用Imports但是在做点操作员的时候并没有表现出来。

感谢您的帮助!!!
Kevin



首先必须在自己的项目中将C#代码构建为* .dll文件和

然后在调用VB.NET中设置对它的引用项目。你不能在同一个项目中使用

不同的语言。


" ke ************* @ state.or &页面没有自动跳转QUOT; <柯*************** @ state.or.us>写在

消息新闻:uM ************** @ TK2MSFTNGP12.phx.gbl ...

你好,
我在C#文件中有代码,我想从VB
DotNet表单中调用该类。代码来自
http://www.dnzone。 COM / ShowDetail.asp?NewSID的= 223 。我更像是一个Delphi
和网络开发者。

我尝试使用Imports但是在做点操作员的时候并没有表现出来。

感谢您的帮助!!!
Kevin



将C#文件放入另一个项目(类库)并在VB.NET Web应用程序中添加一个项目

引用。你不能在单个

项目中混合语言(至少在VS.NET 2005之前)。


-

格雷戈里A. Beamer

MVP; MCP:+ I,SE,SD,DBA


**************************** ********************** *************

在盒子外面思考!

******************************************** ****** *************

" ke ************* @ state.or.us" <柯*************** @ state.or.us>写在

消息新闻:uM ************** @ TK2MSFTNGP12.phx.gbl ...

你好,
我在C#文件中有代码,我想从VB
DotNet表单中调用该类。代码来自
http://www.dnzone。 COM / ShowDetail.asp?NewSID的= 223 。我更像是一个Delphi
和网络开发者。

我尝试使用Imports但是在做点操作员的时候并没有表现出来。

感谢您的帮助!!!
Kevin



Hello,

I have code in a C# file which I want to call the class within from a VB
DotNet form. The code is from
http://www.dnzone.com/ShowDetail.asp?NewsId=223. I am a more of a Delphi and
web developer.

I tried using "Imports" but didn''t show up when doing the dot operator
thing.

Thanks for any assistance!!!
Kevin

解决方案

You first have to build the C# code in its own project into a *.dll file and
then you set reference to it in the calling VB.NET project. You cannot use
different language in the same project.

"ke*************@state.or.us" <Ke***************@state.or.us> wrote in
message news:uM**************@TK2MSFTNGP12.phx.gbl...

Hello,

I have code in a C# file which I want to call the class within from a VB
DotNet form. The code is from
http://www.dnzone.com/ShowDetail.asp?NewsId=223. I am a more of a Delphi and web developer.

I tried using "Imports" but didn''t show up when doing the dot operator
thing.

Thanks for any assistance!!!
Kevin



You first have to build the C# code in its own project into a *.dll file and
then you set reference to it in the calling VB.NET project. You cannot use
different language in the same project.

"ke*************@state.or.us" <Ke***************@state.or.us> wrote in
message news:uM**************@TK2MSFTNGP12.phx.gbl...

Hello,

I have code in a C# file which I want to call the class within from a VB
DotNet form. The code is from
http://www.dnzone.com/ShowDetail.asp?NewsId=223. I am a more of a Delphi and web developer.

I tried using "Imports" but didn''t show up when doing the dot operator
thing.

Thanks for any assistance!!!
Kevin



Put the C# file into another project (class library) and add a project
reference in the VB.NET web app. You cannot mix languages in a single
project (at least not until VS.NET 2005).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** *************
Think outside the box!
************************************************** *************
"ke*************@state.or.us" <Ke***************@state.or.us> wrote in
message news:uM**************@TK2MSFTNGP12.phx.gbl...

Hello,

I have code in a C# file which I want to call the class within from a VB
DotNet form. The code is from
http://www.dnzone.com/ShowDetail.asp?NewsId=223. I am a more of a Delphi and web developer.

I tried using "Imports" but didn''t show up when doing the dot operator
thing.

Thanks for any assistance!!!
Kevin



这篇关于从VB.Net调用C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆