user4667380
user4667380

Reputation: 61

Migration from vb6 to vb.net issue

enter image description here

I used the upgrade tool of visual studio to upgrade . In the above code

 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

Now if i am trying to do this Dim a = Len(labels) this give me 230 but it should suppose to give me 644 .In vb6 its 644 .

Please tell me where i am wrong . Any help will be greatfull

Upvotes: 0

Views: 254

Answers (1)

NishantMittal
NishantMittal

Reputation: 537

I think this issue is because of API which is not supported in VB.

Upvotes: 0

Related Questions