如何在Visual Stdio 2010中的另一个页面中调用类 [英] how to call a class in another page in visual stdio 2010

查看:124
本文介绍了如何在Visual Stdio 2010中的另一个页面中调用类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我已经在vs 2010中创建了一个Web项目,并在App_Code,DAC和Model中创建了一个文件夹.
在DAC中创建类A,在模型中创建类B.
并创建一个Web表单Default.aspx.
在Default.aspx.vb中,我想调用A类和B类.

请帮助我

Dear All,

i have create a web Project in vs 2010, and make a folder in App_Code, DAC and Model.
in DAC create Class A and Model Create class B.
and create a web form Default.aspx.
in Default.aspx.vb i want to call Class A And B.

Please help me

推荐答案

嗨Dinesh,

请公开您的A类和B类,然后可以在任何页面中创建该类的对象.默认情况下,C#类访问是私有的.
Hi Dinesh,

Please make your class A and B public and after that can create the object of the class in any page. By default C# class access are private.


尝试通过将其定义为public static.您可以做一件事.您必须在要访问的类中添加对类或项目的引用.
try by defining it public static. You can do one thing more. You have to add reference of your class or project where you want to access.


将类设为公共,并且应在Default.aspx.vb

最好的
戈皮纳特·纳塔拉让(Gopinath Natarajan)
Make the classes as public and you should add namespace of the class in the Default.aspx.vb

All the Best
Gopinath Natarajan


这篇关于如何在Visual Stdio 2010中的另一个页面中调用类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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