PRivate Declare Function GetPrivateProfileString _ Lib "kernel32" Alias "GetPrivateProfileStringA" ( _ ByVal lpapplicationName As String, _ ByVal lpKeyName As Any, _ ByVal lpDefault As String, _ ByVal lpReturnedString As String, _ ByVal nSize As Long, _ ByVal lpFileName As String) As Long 可以由两个 Declare 版本代替,一个接受 Long,一个接受字符串。
Overloads Private Declare Function GetPrivateProfileStringKey _ Lib "kernel32" Alias "GetPrivateProfileStringA" ( _ ByVal lpApplicationName As String, _ ByVal lpKeyName As String, _ ByVal lpDefault As String, _ ByVal lpReturnedString As String, _ ByVal nSize As Long, _ ByVal lpFileName As String) As Long Overloads Private Declare Function GetPrivateProfileStringNullKey _ Lib "kernel32" Alias"GetPrivateProfileStringA" ( _ ByVal lpApplicationName As String, _ ByVal lpKeyName As Long, _ ByVal lpDefault As String, _ ByVal lpReturnedString As String, _ ByVal nSize As Long, _ ByVal lpFileName As String) As Long 这提高了类型的安全性,并减少了导致程序失败的小毛病。这一情况的存在是因为编译器不允许通过没有显式定义的数据类型来调用 API。
Interface _b Function MyFunction() As String End Interface Class a Implements _b Function b_MyFunction() As String Implements _b.MyFunction End Function End Class
属性 Visual Basic 6.0 在 Visual Basic 6.0 中,特定属性的 Get、Let 和 Set 属性函数可以通过不同级别的访问选项声明。例如,Property Get 函数可以声明为 Public 而 Property Let 可以声明为 Friend。
Visual Basic.NET
属性的 Get 和 Set 函数必须具有相同级别的访问选项。这样就便于 Visual Basic.NET 与其他 .NET 语言协同操作。
Dim MyGCHandle As GCHandle = GCHandle.Alloc(o,GCHandleType.Pinned) Dim Address As Integer = CInt(MyGCHandle.AddrOfPinnedObject()) '... MyGCHandle.Free() '再次允许移动对象实例 允许运行时移动数据项目能够改善运行时的性能。