BDFarm
BDFarm

Reputation: 63

Casting error in VB 4.5 when turning Option Strict On

The following code works great with Option Strict off. However flipping the switch to On gives me the following error - *Value of type DSreprint_ship.companyRow cannot be converted to DSholding.companyRow*. on 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

I've researched this until I'm blue in the face and can't seem to see the issue. Any help is appreciated.

Upvotes: 0

Views: 67

Answers (1)

JaredPar
JaredPar

Reputation: 755457

The problem here is that you are using two different row types. They DSreprent_ship.companyRow is different than DSHolding.companyRow` type. Change the declaration of row to the following

Dim row As DSreprint_ship.companyRow

Upvotes: 1

Related Questions