Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Please look this problem

http://stackoverflow.com/questions/34592625/migration-from-vb6-to-vb-net-issue

Please tell me where i am wrong . Any help will be greatfull
Posted
Comments
Sergey Alexandrovich Kryukov 5-Jan-16 2:15am    
This is my advice: read thoroughly the comment #1 to your stackoverflow question, it's good.
—SA

1 solution

There are common issues exist when migrating from VB6 to Visual Basic .NET, it will not 100% upgrade, you need to Remove dead and duplicated code, check for Unused library references, For user-defined interfaces, the wizard creates both class and interface definitions, Couldn't resolve default property of object <variable name="">
see below link for more detail
Common issues when migrating from VB6 to Visual Basic .NET[^]
 
Share this answer
 
Comments
Member 12244430 5-Jan-16 2:41am    
I'm using this code----
Dim length As Integer
length = Len(labels)
FileOpen(labelfile, My.Application.Info.DirectoryPath & "\Data\label." & extension, OpenMode.Random, , , length)
Dim i As Short
Dim fsz As Short
fsz = filesize(labelfile)
Dim a = Len(labels)
i = 1
Do Until i = 54 ' fsz
'UPGRADE_WARNING: Get was upgraded to FileGet and has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
FileGet(labelfile, labels, i)

setBandsOnLabel()
i = i + 1
Loop

Sub setBandsOnLabel()
Dim i As Short
Dim fsz As Short
' labels.intBandsOnLabel = 0
fsz = filesize(bandfile)
i = 1
Do Until i = fsz
'UPGRADE_WARNING: Get was upgraded to FileGet and has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
FileGet(bandfile, bands, i)
If (bands.intSigned = labels.intKey) Then
labels.intBandsOnLabel = labels.intBandsOnLabel + 1
End If
i = i + 1
Loop
Dim a As Integer = Len(labels)

FilePut(labelfile, labels, labels.intKey)

End Sub



Getting error of Bad length record on Last line i.e FilePut
Please provide some solution or any alternative to open,read and write structure 'label'.
koolprasad2003 5-Jan-16 2:44am    
what your 'FilePut' method exactly does ? what is the original VB code
Member 12244430 5-Jan-16 2:51am    
Vb6 code is here-----

Private Sub cmdOk_Click()
Dim length As Long
length = Len(preferences)
Open App.Path & "\Data\prefs.gam" For Random As preferencesFile Len = length
With preferences
.strNationality = Trim(cmbNationality.text)
.strForename = Trim(txtName.text)
.strSurname = Trim(txtSurname.text)
If (optGender(0).value = True) Then
.bytGender = 0
Else
.bytGender = 1
End If
.bytDay = Trim(cmbDay.text)
.strMonth = Trim(cmbMonth.text)
.intYear = Trim(cmbYear.text)
End With
Put preferencesFile, 1, preferences
Close preferencesFile
Dim i As Integer
Dim fsz As Integer
fsz = filesize(labelfile)
i = 1
Do Until i = fsz
Get labelfile, i, labels
setBandsOnLabel
i = i + 1
Loop
personals.strForename = txtName
personals.strSurname = txtSurname
'datGameDate = Date
datStartDate = DateSerial(2004, 8, 5)
datGameDate = datStartDate
intYear = year(datGameDate)
Me.Hide
If optCreateNew(0).value = True Then
frmCreateNewLabel.left = Me.left
frmCreateNewLabel.top = Me.top
frmCreateNewLabel.show
Else
frmManageExistingLabel.left = Me.left
frmManageExistingLabel.top = Me.top
frmManageExistingLabel.show
End If
setPlayerStats
End Sub

Function filesize(file As Byte) As Long
Dim length As Long
Dim size As Long
size = LOF(file)
Select Case file
Case newsFile
length = Len(newsVar)
Case newBandFile
length = Len(newbands)
Case countryFile
length = Len(countries)
Case cityFile
length = Len(cities)
Case venuefile
length = Len(venues)
Case forenameFile
length = Len(forenames)
Case surnamefile
length = Len(surnames)
Case jobfile
length = Len(jobs)
Case stylefile
length = Len(styles)
Case artistfile, cheatArtistFile
length = Len(artists)
Case bandfile, cheatBandFile
length = Len(bands)
Case productfile
length = Len(products)
Case labelfile
length = Len(labels)
Case stafffile
length = Len(staffs)
Case lookfile
length = Len(looks)
Case associatedLookFile
length = Len(associatedlooks)
Case scheduleEventFile
length = Len(scheduleEvents)
Case discfile
length = Len(discs)
Case songfile
length = Len(songs)
Case offerfile
length = Len(offers)
Case associatedStyleFile
length = Len(associatedStyles)
Case associatedNationFile
length = Len(associatedNations)
Case businessFile
length = Len(businesses)
Case newsongfile
length = Len(newsongs)
Case tourfile
length = Len(tours)
Case gigfile
length = Len(gigs)
Case festivalfile
length = Len(festivals)
Case gameEventFile
length = Len(gameEvents)
Case crimeFile
length = Len(crimes)
Case awardfile
length = Len(awards)
Case ceremonyfile
length = Len(ceremonies)
Case shortlistFile
length = Len(shortlists)
Case chartEntryFile
length = Len(chartEntries)
Case chartRecordListFile
length = Len(chartRecords)
Case mediaFile
length = Len(medias)
Case achievementFile
length = Len(achievements)
Case thankFile
length = Len(thanks)
Case factFile
Dim facts As fact
length = Len(facts)
Case highScoreFile
length = Len(highScores)
Case newAlbumFile
length = Len(newAlbums)
End Select
filesize = (size \ length) + 1
End Function

Sub setBandsOnLabel()
Dim i As Integer
Dim fsz As Integer
labels.intBandsOnLabel = 0
fsz = filesize(bandfile)
i = 1
Do Until i = fsz
Get bandfile, i, bands
If (bands.intSigned = labels.intKey) Then
labels.intBandsOnLabel = labels.intBandsOnLabel + 1
End If
i = i + 1
Loop
Put labelfile, labels.intKey, labels
End Sub
Member 12244430 5-Jan-16 2:53am    
In vb6 the Len(label) calculate is 644
and in vb.net it is calculating 230.
2 structure i.e. department and account is called under 'label' structure.
I'm stuck and unable to proceed.Please help me.
Member 12244430 5-Jan-16 2:54am    
Vb6 types---------

Type department
bytNumberOfEachAbility(4) As Byte
bytQuality As Byte
intBoss As Integer
bytFreeTime As Byte
End Type

Type account
curIGigs As Currency
curISales As Currency
curIInvestments As Currency
curIBusinesses As Currency
curIRecoupedAdvances As Currency
curIOther As Currency
curEWages As Currency
curEAdvances As Currency
curEProduction As Currency
curEManufacture As Currency
curEStudios As Currency
curEBusinesses As Currency
curERoyalties As Currency
curEOther As Currency
curTotal As Currency
End Type

Type label
intKey As Integer
strName As String * 32
intBoss As Integer
bytAge As Byte
intFormed As Integer
strLogo As String * 20
intOwner As Integer 'points to other label

datLastAudition As Date '
bytMaxBands As Byte '

curCash As Currency
curWageBill As Currency
curMinCash As Currency
curRealCash As Currency
accounts(2) As account

departments(5) As department

bytMinControversy As Byte
bytMaxControversy As Byte
bytGenre As Byte

lngUkPoints As Long
lngUsPoints As Long
lngEuroPoints As Long
lngAusPoints As Long
lngGlobalPoints As Long

bytUkReputation As Byte
bytUsReputation As Byte
bytEuroReputation As Byte
bytAusReputation As Byte
bytGlobalReputation As Byte
intUkRepVar As Integer
intusRepVar As Integer
intEuroRepVar As Integer
intAusRepVar As Integer
intGlobalRepVar As Integer

intBandsOnLabel As Integer

lngTotalUkSingleSales As Long
lngtotalUkAlbumSales As Long
lngTotalUsSingleSales As Long
lngtotalUsAlbumSales As Long
lngTotalEuroSingleSales As Long
lngtotalEuroAlbumSales As Long
lngTotalAusSingleSales As Long
lngtotalAusAlbumSales As Long
lngTotalGlobalSingleSales As Long
lngtotalGlobalAlbumSales As Long
intUKWeeksOnChartAlbum As Integer
intUkWeeksOnChartSingle As Integer
intUsWeeksOnChartAlbum As Integer
intUsWeeksOnChartSingle As Integer
intEuroWeeksOnChartAlbum As Integer
intEuroWeeksOnChartSingle As Integer
intAusWeeksOnChartAlbum As Integer
intAusWeeksOnChartSingle As Integer 'do these integers need to be longs?
lngMostWeeklySingleSales As Long
lngMostWeeklyAlbumSales As Long
intMostWeeklySingleSalesLoc As Integer
intMostWeeklyAlbumSalesLoc As Integer
intBiggestSellingSingleLoc As Integer
intBiggestSellingAlbumLoc As Integer

bytChartHistory(0 To 3, 0 To 3) As Byte

End Type

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900