从vb6迁移到vb.net问题

时间:2016-01-04 13:48:03

标签: vb.net vb6

enter image description here

我使用visual studio的升级工具进行升级。 在上面的代码中

 Structure label
    Dim intKey As Short
    'UPGRADE_WARNING: Fixed-length string size must fit in the buffer. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="3C1E4426-0B80-443E-B943-0627CD55D48B"'
    <VBFixedString(32), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=32)> _
    Public strName As String
    Dim intBoss As Short
    Dim bytAge As Byte
    Dim intFormed As Short
    'UPGRADE_WARNING: Fixed-length string size must fit in the buffer. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="3C1E4426-0B80-443E-B943-0627CD55D48B"'
    <VBFixedString(20), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=20)> _
    Public strLogo As String
    Dim intOwner As Short 'points to other label
    Dim datLastAudition As Date '
    Dim bytMaxBands As Byte '
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curCash As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curWageBill As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curMinCash As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curRealCash As Long
    <VBFixedArray(2)>
    Dim accounts() As account
    'UPGRADE_WARNING: Array departments may need to have individual elements initialized. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="B97B714D-9338-48AC-B03F-345B617E2B02"'
    <VBFixedArray(5)>
    Dim departments() As department
    Dim bytMinControversy As Byte
    Dim bytMaxControversy As Byte
    Dim bytGenre As Byte
    Dim lngUkPoints As Integer
    Dim lngUsPoints As Integer
    Dim lngEuroPoints As Integer
    Dim lngAusPoints As Integer
    Dim lngGlobalPoints As Integer
    Dim bytUkReputation As Byte
    Dim bytUsReputation As Byte
    Dim bytEuroReputation As Byte

    Dim bytAusReputation As Byte


    Dim bytGlobalReputation As Byte
    Dim intUkRepVar As Short
    Dim intusRepVar As Short
    Dim intEuroRepVar As Short
    Dim intAusRepVar As Short
    Dim intGlobalRepVar As Short
    Dim intBandsOnLabel As Short
    Dim lngTotalUkSingleSales As Integer
    Dim lngtotalUkAlbumSales As Integer
    Dim lngTotalUsSingleSales As Integer
    Dim lngtotalUsAlbumSales As Integer
    Dim lngTotalEuroSingleSales As Integer
    Dim lngtotalEuroAlbumSales As Integer
    Dim lngTotalAusSingleSales As Integer
    Dim lngtotalAusAlbumSales As Integer
    Dim lngTotalGlobalSingleSales As Integer
    Dim lngtotalGlobalAlbumSales As Integer
    Dim intUKWeeksOnChartAlbum As Short
    Dim intUkWeeksOnChartSingle As Short
    Dim intUsWeeksOnChartAlbum As Short
    Dim intUsWeeksOnChartSingle As Short
    Dim intEuroWeeksOnChartAlbum As Short
    Dim intEuroWeeksOnChartSingle As Short
    Dim intAusWeeksOnChartAlbum As Short
    Dim intAusWeeksOnChartSingle As Short 'do these integers need to be longs?
    Dim lngMostWeeklySingleSales As Integer
    Dim lngMostWeeklyAlbumSales As Integer
    Dim intMostWeeklySingleSalesLoc As Short
    Dim intMostWeeklyAlbumSalesLoc As Short
    Dim intBiggestSellingSingleLoc As Short
    Dim intBiggestSellingAlbumLoc As Short
    <VBFixedArray(3, 3)> Dim bytChartHistory(,) As Byte

    'UPGRADE_TODO: "Initialize" must be called to initialize instances of this structure. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="B4BFF9E0-8631-45CF-910E-62AB3970F27B"'
    Public Sub Initialize()
        ReDim accounts(2)
        ReDim departments(5)
        ReDim bytChartHistory(3, 3)
    End Sub
End Structure
Structure account
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curIGigs As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curISales As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curIInvestments As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curIBusinesses As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curIRecoupedAdvances As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curIOther As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curEWages As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curEAdvances As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curEProduction As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curEManufacture As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curEStudios As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curEBusinesses As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curERoyalties As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curEOther As Long
    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Currency)> _
    Dim curTotal As Long


    'Dim curIGigs As Long
    'Dim curISales As Long

    'Dim curIInvestments As Long
    'Dim curIBusinesses As Long
    'Dim curIRecoupedAdvances As Long
    'Dim curIOther As Long
    'Dim curEWages As Long
    'Dim curEAdvances As Long
    'Dim curEProduction As Long
    'Dim curEManufacture As Long
    'Dim curEStudios As Long
    'Dim curEBusinesses As Long
    'Dim curERoyalties As Long
    'Dim curEOther As Long
    'Dim curTotal As Long



End Structure
Structure department
    <VBFixedArray(4)> Dim bytNumberOfEachAbility() As Byte
    Dim bytQuality As Byte
    Dim intBoss As Short
    Dim bytFreeTime As Byte

    'UPGRADE_TODO: "Initialize" must be called to initialize instances of this structure. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="B4BFF9E0-8631-45CF-910E-62AB3970F27B"'
    Public Sub Initialize()
        ReDim bytNumberOfEachAbility(4)
    End Sub
End Structure

现在,如果我想这样做   Dim a = Len(标签) 这给了我230 但它应该假设给我644.在vb6它的644。

请告诉我我错在哪里。任何帮助都会很棒

1 个答案:

答案 0 :(得分:0)

我认为这个问题是因为VB不支持API。