VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Allows VB5 to open VB6 projects without having to edit the file and remove the 'Retained=' flag (or

by AnonymousVBer (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 28th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Allows VB5 to open VB6 projects without having to edit the file and remove the 'Retained=' flag (or any other flags not appropriate for VB5).

Rate Allows VB5 to open VB6 projects without having to edit the file and remove the 'Retained=' flag (or



Dim ReadString As String
Dim NeedsToBeConverted As Boolean

On Error GoTo Err_Handler

'first see if it needs to be converted.
Open Command() For Input As #1

Do While Not EOF(1)
Line Input #1, ReadString
'add any other invalid commands
If InStr(1, ReadString, "Retained") <> 0 Then
NeedsToBeConverted = True
'if it does then we can exit do and move along
Exit Do
End If
Loop

Close #1


'if it needs to be converted then do it
If NeedsToBeConverted Then

Open Command() For Input As #1
'in case theres a file already here with this name
'delete it
If Dir(Command() & ".tmp") <> "" Then
Kill Command() & ".tmp"
End If

'create a new file with the same name but a .tmp on the end
Open Command() & ".tmp" For Output As #2

Do While Not EOF(1)
Line Input #1, ReadString
'if ReadString has 'retained' in it then dont write it to the
'tmp file.
If InStr(1, ReadString, "Retained") = 0 Then
Print #2, ReadString
End If
Loop

Close #1
Close #2

'if theres a file with this name then delete it
If Dir(Command() & ".old") <> "" Then
Kill Command() & ".old"
End If
'now rename the original file with a .old on the end
Name Command() As Command() & ".old"
'name the new one the same as the original
Name Command() & ".tmp" As Command()
'let the user know all went well
MsgBox "The file " & Command() & " has been converted."
End
Else
'if it did not need to be converted let the user know
'and exit
MsgBox "The file " & Command() & " does not need to be converted."
End
End If


Err_Handler:
MsgBox "There was an error: " & Err.Description

End Sub


Download this snippet    Add to My Saved Code

Allows VB5 to open VB6 projects without having to edit the file and remove the 'Retained=' flag (or Comments

No comments have been posted about Allows VB5 to open VB6 projects without having to edit the file and remove the 'Retained=' flag (or. Why not be the first to post a comment about Allows VB5 to open VB6 projects without having to edit the file and remove the 'Retained=' flag (or.

Post your comment

Subject:
Message:
0/1000 characters