Vb.net VB4.5中打开选项Strict时的铸造错误

Vb.net VB4.5中打开选项Strict时的铸造错误,vb.net,.net-4.5,Vb.net,.net 4.5,下面的代码在关闭选项Strict时非常有效。但是,将开关拨到On会出现以下错误-*类型为DSreprint\u ship.companyRow的值无法转换为DSholding.companyRow*。在Me.DSreprint_船公司 Dim row As DSholding.companyRow For Each row In Me.DSreprint_ship.company If row.PLANT = Me.DSreprint_ship.shipmaster.It

下面的代码在关闭选项Strict时非常有效。但是,将开关拨到On会出现以下错误-*类型为DSreprint\u ship.companyRow的值无法转换为DSholding.companyRow*。在Me.DSreprint_船公司

Dim row As DSholding.companyRow
    For Each row In Me.DSreprint_ship.company
        If row.PLANT = Me.DSreprint_ship.shipmaster.Item(0).plant Then
            If row.IsCITYNull Then
                From_city = "null"
            Else
                From_city = row.CITY
            End If
            If row.IsSTATENull Then
                From_state = "null"
            Else
                From_state = row.STATE
            End If

        End If
    Next

我一直在研究这个问题,直到我脸色发青,似乎看不出问题所在。非常感谢您的帮助。

这里的问题是您使用了两种不同的行类型。它们
DSreprent\u ship.companyRow
与DSHolding.companyRow`类型不同。将行的声明更改为以下内容

Dim row As DSreprint_ship.companyRow

DSreprint\u ship.company
是否是
DSholding.companyRow
对象的列表?…并且
Me.DSreprint\u ship.company
是否实际包含/代表了
DSholding.companyRow
项目的集合?对Karl和Puropoix都是-对这两个问题都是。