转动Option Strict On时VB 4.5中的转换错误

时间:2013-11-21 16:24:25

标签: vb.net .net-4.5

以下代码适用于Option Strict off。但是,将开关翻转为On会出现以下错误 - * DSreprint_ship.companyRow类型的值无法转换为DSholding.companyRow * 。在Me.DSreprint_ship.company

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

我已经研究过这个问题,直到我脸色发青,似乎看不出问题。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:1)

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

Dim row As DSreprint_ship.companyRow
相关问题