比如给你个简单的例子。你看看,你先建立个类文件。。命名随你定,这里我命名mycls.vb,代码如下Imports System Imports System.Web Imports System.Web.uiPublic Class mycls Public Function ChkStr(ByVal strName As String) As String If strName = "苯苯" Then System.Web.HttpContext.Current.Response.Write("<script>alert('好笨,好笨');</script>") Else System.Web.HttpContext.Current.Response.Write("<script>alert('你是谁?');</script>") End If End Function End Class然后在你要调用这个类的页面里面,这样写:dim gocls as mycls = new mycls gocls.ChkStr("苯苯")然后结果你看看就知道了,这是最简单了,当然你可以就这样自己修改成你需要的
Imports System.Web
Imports System.Web.uiPublic Class mycls
Public Function ChkStr(ByVal strName As String) As String
If strName = "苯苯" Then
System.Web.HttpContext.Current.Response.Write("<script>alert('好笨,好笨');</script>")
Else
System.Web.HttpContext.Current.Response.Write("<script>alert('你是谁?');</script>")
End If
End Function
End Class然后在你要调用这个类的页面里面,这样写:dim gocls as mycls = new mycls
gocls.ChkStr("苯苯")然后结果你看看就知道了,这是最简单了,当然你可以就这样自己修改成你需要的
using System;
............
............
namespace name1
{
class1
{
string function1()
{
}
}
}
test.aspx2
using System;
...........
..........
namespace name2
{
class2
{
class1 gao=new class1();
string str=gao.function1();
}
}