在VB6我们这是在模块文件中声明的全局变量。
In VB6 we have global variables which are declared in module files.
在.NET中,我们是否有这样一个概念?抑或是通过会话变量替换之类的东西类的静态常量变量这可以作为全球数据?
In .NET, do we have such a concept? Or is it replaced by session variables and things like static constant variables of class which can be used as global data?
在VB.NET,你可以添加模块文件。在这个模块文件,你必须使用公共声明变量和/或功能。但是,这仅仅是在VB.NET
In VB.NET, you can add module file. In that module file, you had to declare variable and/or functions with Public. But this is only in VB.NET
例如,模块文件会是这样
Example, module file would be like this
Module UserDetails
Public SqlCon as SqlConnection
Public DataSet as DataSet
Public dataAdaptr as SqlDataAdapter
End Module
在上面的例子中,我使用SQL连接,数据集,数据适配器免遭任何形式,类和模块。
In above example, i am using sql connection, data set, data adapter from any form, class and module.
这个例子被用在我的项目了。您可以在Asp.net项目中也用这个。
This example is being used in my projects already. You can use this in your Asp.net projects too.