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() '再次允許移動對象實例 允許運行時移動數據項目能夠改善運行時的性能。