以下是引用affixed在2018/12/26 16:01:00的发言:
结果还是原来的提示内容:不存在名称为"测试"的Table! 而不是"测试,不存在表【测试】"
请认认真真看7楼代码,以及调用代码。
Public Class myTableCollection
Public Sub new
End Sub
Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of Table)
Return foxtable.Tables.GetEnumerator
End Function
Default Public readonly Property Item(tname As String) As Table
Get
If Foxtable.Tables.Contains(tname) Then
Return Foxtable.Tables(tname)
Else
msgbox("测试,不存在表【" & tname & "】")
Return Nothing
End If
End Get
End Property
Public readonly Property count() As Integer
Get
Return foxtable.Tables.count
End Get
End Property
Public readonly Property contains(tname As String) As Boolean
Get
Return foxtable.Tables.contains(tname)
End Get
End Property
End Class
Public mytables = new myTableCollection
readonly Property Tables As myTableCollection
Get
Return mytables
End Get
End Property
-----------------------
msgbox(Tables.Gettype.name)
msgbox(Tables("表B").name)
MainTable = Tables("表B")
MainTable = Tables("表abc")