Click here to Skip to main content
15,746,652 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello friends i recently converted my VB6 project to
I am getting the following errors in the converted project:

'UPGRADE_ISSUE: Constant vbUnicode was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="55B59875-9A95-4B71-9D6A-7C294BF7139D"'
'UPGRADE_ISSUE: InputB function is not supported. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="367764E5-F3F8-4E43-AC3E-7FE0B5E074E2"'

Following is the code snippet which gives the error:

 Dim EncryptedFilePath As String

 Dim EncryptedFileNumber As Integer

 Dim EncryptedText As String
EncryptedText = StrConv(InputB(LOF(EncryptedFileNumber), EncryptedFileNumber), vbUnicode)

Please correct this code snippet.

What I have tried:

i tried this but it is returning some other result. I am new to VB6 and, please help.

' The input String.
Dim value As String = LOF(EncryptedFileNumber)

' Convert String to Byte array.
Dim array() As Byte = System.Text.Encoding.ASCII.GetBytes(value)

EncryptedText = System.Text.Encoding.Default.GetString(array)
Updated 22-Jan-19 1:09am

1 solution

That code is reading the contents of a file which you have previously opened. You will presumably have a previous line that looks something like:
Open EncryptedFilePath For Input As #EncryptedFileNumber

File IO is much easier in .NET - the System.IO namespace[^] gives you all the tools you need.

Replace the Open / InputB / Close lines with:
Dim EncryptedText As String = System.IO.File.ReadAllText(EncryptedFilePath)

Basics of .NET Framework File I/O and the File System (Visual Basic) | Microsoft Docs[^]
Share this answer
Maciej Los 23-Jan-19 8:13am    

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