add a vb file, make your method a Shared method of some class or a method in a Modulepublic class SomeClass public shared sub YourMethod() '... end subend classthen call SomeClass.YourMethod()orModule YourModule public sub YourMethod() '... end subEnd Modulethen call YourModule.YourMethod()
1.定义: public class ClassName { public static void FunctionName() { //do something here } }2.使用方法:ClassName.FunctionName(); 3.注意:这个函数必须是静态的(static)
public shared sub YourMethod()
'...
end subend classthen call SomeClass.YourMethod()orModule YourModule public sub YourMethod()
'...
end subEnd Modulethen call YourModule.YourMethod()
public class ClassName
{
public static void FunctionName()
{
//do something here
}
}2.使用方法:ClassName.FunctionName();
3.注意:这个函数必须是静态的(static)
一:module (对于以往vb开发中常用的方法)
二: shared (.net 中一切可以看作对象处理, 对象中的方法用shared关键字後
就成为可以直接使用的,不须实例化的方法,用法和modeule类似。
如:namespace.class.method(params)