从Vb6到Vb.net的转换错误-不再支持Gosub / Return?

时间:2019-04-08 10:38:56

标签: vb.net vb6

我已使用VS2008将我的应用程序代码从VB6转换为VB.NET,我正在尝试解决所产生的错误。

此刻,我遇到关于GoSub和与此相关的Return的错误。

  

GoSub:不再支持语句

  

返回:函数,获取或运算符中的'Return'语句必须返回一个值。'

有人可以在这里建议我如何解决这些问题。

在此处提供示例代码:

ElseIf aSegment(0) = "XXXXXX" Then 
    GoSub RemoveBooking
    GoSub TuneTrade                
    GoSub GetAlloRoute                
    GoSub AddBooking

这是上述功能之一的代码:

TuneTrade:       
    If Trim(aBooking(23)) = "" Then
        aBooking(23) = "???/???"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "CN" Then
        aBooking(23) = "EUR/FEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "JN" Then
        aBooking(23) = "EUR/FEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "MY" Then
        aBooking(23) = "EUR/FEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "ID" Then
        aBooking(23) = "EUR/FEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "TW" Then
        aBooking(23) = "EUR/FEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "VN" Then
        aBooking(23) = "EUR/FEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "IN" Then
        aBooking(23) = "EUR/MEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "SA" Then
        aBooking(23) = "EUR/MEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "KW" Then
        aBooking(23) = "EUR/MEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "PK" Then
        aBooking(23) = "EUR/MEA"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "US" Then
        aBooking(23) = "EUR/NAM"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "CA" Then
        aBooking(23) = "EUR/NAM"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "ZA" Then
        aBooking(23) = "EUR/SAF"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "MX" Then
        aBooking(23) = "EUR/SAM"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "BR" Then
        aBooking(23) = "EUR/SAM"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "AU" Then
        aBooking(23) = "EUR/ANZ"
    ElseIf Left(aBooking(23), 3) = "EUR" And aBooking(30) = "NZ" Then
        aBooking(23) = "EUR/ANZ"
    ElseIf aBooking(23) = "MED/NAM" Then  'Mediterrenean trade
        'Should be EUR/NAM, acc. to SSC012 on 31/05/2007, 11:30
        aBooking(23) = "EUR/NAM"
    ElseIf aBooking(23) = "EUR/IOI" Then  'Indian Ocean Islands
        'Should be EUR/SAF, acc. to SSC012 on 31/05/2007, 11:30
        aBooking(23) = "EUR/SAF"
    ElseIf aBooking(23) = "EUR/CRB" Then  'Exception: Carribrean=SAM
        aBooking(23) = "EUR/SAM"
    ElseIf aBooking(23) = "EUR/CAM" Then  'Exception: CAM =SAM
        aBooking(23) = "EUR/SAM"
    ElseIf aBooking(23) = "EUR/ESA" Then  'Exception: ESA=SAM
        aBooking(23) = "EUR/SAM"
    ElseIf aBooking(23) = "EUR/WSA" Then  'Exception: WSA=SAM
        aBooking(23) = "EUR/SAM"
    ElseIf aBooking(23) = "EUR/FAS" Then  'Exception: FAS=SAM
        aBooking(23) = "EUR/SAM"
    ElseIf aBooking(23) = "EUR/AUS" Then  'Exception: AUS=OCE
        aBooking(23) = "EUR/ANZ"
    ElseIf aBooking(23) = "EUR/NEZ" Then  'Exception: NEZ=OCE
        aBooking(23) = "EUR/ANZ"
    ElseIf Left(aBooking(23), 3) <> "EUR" Then  'Non-EUR trade
        '    ReadGds = True        'No log required
        '    Exit Function
    End If

    Return

0 个答案:

没有答案