I have converted some code from VB6 to VB.NET, using the default CTRL-ALT-F10 where necessary.
I now get an error on the line:
For Each objChild In objItem.value(iSub)
saying that
Expression is of type 'Object', which is not a collection type.
Does any one have the correct conversion please?
Original VB code
Private Function ValidateAnItem(ByRef objItem As TDS.ItemField) As String
For iSub = 1 To objItem.Value.Count
If objItem.FieldType = FieldTypeEmbed Then
For Each objChild In objItem.Value(iSub)
strReturn = ValidateAnItem(objChild, strAdministrator)
If strReturn <> "" Then
ValidateAnItem = strReturn
Set objChild = Nothing
Exit For
Exit Function
End If
Next
End If
Next
code converted to vb.net
Public Function ValidateAnItem(ByRef objItem As TDS.ItemField) As String
Dim objChild As TDS.ItemField
For iSub = 1 To objItem.value.Count
If objItem.FieldType = TDSDefines.EnumTridionWebSchemaFieldType.FieldTypeEmbed Then
For Each objChild In objItem.value(iSub)
strReturn = ValidateAnItem(objChild)
If strReturn <> "" Then
ValidateAnItem = strReturn
objChild = Nothing
Exit For
Exit Function
End If
[...]