【发布时间】:2020-08-24 23:16:00
【问题描述】:
我在使用集合时遇到了一些麻烦,因为设置的字段名称并不总是很好用(我检查了 100 次名称都可以),所以我想通过它的索引从集合中获取一个元素值。类似于: Coll(2,3) 给了我第三列的第二行。
我知道有一个 读取集合字段 操作,但它需要字段名称:
If RowIndex < 0 OrElse Coll.Rows.Count <= RowIndex Then
Throw New ApplicationException("The supplied row index falls outside of the valid range.")
End If
If Not Coll.Columns.Contains(FieldName) Then
Throw New ApplicationException("The collection does not contain a field with the name '" & FieldName & "'")
End If
Value_Read = CStr(Coll.Rows(RowIndex)(FieldName))
如何将 FieldName 替换为 ColIndex 或类似的东西?
谢谢:)
【问题讨论】: