devxlogo

Convert a VB6 project back to VB5

Convert a VB6 project back to VB5

If you load a VB6 project file in the VB5 environment you get a warning, even though the project is correctly loaded. The cause of the warning is a VB6 attribute “Retained” (that is, the “Retained in memory” option in the Project Properties dialog box) that isn’t recognized by VB5. If you want to make a VB6 .vbp file backward campatibile with VB5 you can convert it using the following routine:

' Convert a VB6 VBP file so that it can be read' into VB5 IDE without any error'' Returns True if successful,' False if the project was already in VB5 formatFunction ConvertVB6Project(ByVal filename As String) As Boolean    Dim fnum As Long    Dim fileText As String    Dim i As Long        fnum = FreeFile    ' if the file doesn't exist, this statement raises an error    Open filename For Input As #fnum    ' read the entire fire and close it    fileText = Input$(LOF(fnum), fnum)    Close #fnum        ' strip the "Retained" attribute    ' we could easily delete it using the Replace function    ' but we want this function to work under VB5 as well    ' for obvious reasons    i = InStr(1, fileText, "Retained=", vbTextCompare)    ' if not found this is a VB5 project file    If i = 0 Then Exit Function        ' delete this line (account for the CRLF)    fileText = Left$(fileText, i - 1) & Mid$(fileText, _        i + Len("Retained=0") + 2)        ' save to the same file    Open filename For Output As #fnum    Print #fnum, fileText;    Close #fnum        ' signal success    ConvertVB6Project = TrueEnd Function

See also  Comparing different methods of testing your Infrastructure-as-Code
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist