Can someone please help me converting this code from VB6 To VB.NET?
Private Sub cmdCreateLog_Click()
Dim lngLocation As Long
Dim strLine As String
Open "c:\test.pdf" For Binary As #1 ' Open file just created.
Open "c:\pdfTest.txt" For Output As #2
Do While lngLocation < LOF(1) ' Loop until end of file.
strLine = Input(1, #1) ' Read character into variable.
lngLocation = Loc(1) ' Get current position within file.
Print #2, lngLocation & " " & Replace(Replace(strLine, vbLf, "line feed"), vbCr, "carriage return") & vbCrLf;
Loop
Close #1 ' Close file.
Close #2
End
End Sub
John | | JohnFL Monday, November 09, 2009 9:30 PM | Please enter into code editor window. You will find this menu option in VS2008 IDE.
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. - Marked As Answer byJohnFL Monday, November 16, 2009 3:33 PM
-
| | Riquel_Dong Monday, November 16, 2009 7:17 AM | Hi,
Are you looking for automated way of migration, then try to use the upgrade wizard provided by Microsoft (Artinsoft). If only this program it easy to rewrite to code in VB.Net or C#
REgards Azhar
Thanks and Regards
Azhar Amir | | Azhar_Amir Thursday, November 12, 2009 6:09 AM | I don't have vb6 project to convert to .net it's just this code John | | JohnFL Thursday, November 12, 2009 2:20 PM | IDE has one feature for your using in this situation: Tools->Upgrade VB 6 code
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. | | Riquel_Dong Friday, November 13, 2009 9:31 AM | Which IDE are you talking about because I can't find anything in VS2K8
Thanks John | | JohnFL Friday, November 13, 2009 3:10 PM | Please enter into code editor window. You will find this menu option in VS2008 IDE.
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. - Marked As Answer byJohnFL Monday, November 16, 2009 3:33 PM
-
| | Riquel_Dong Monday, November 16, 2009 7:17 AM | It worked! To clarify. 1) You have to be in Code Design 2) Click on Tools
3) Click on Upgrade Visual Basic 6 Code...
VoilĂ !
Private Sub cmdCreateLog_Click()
Dim lngLocation As Integer
Dim strLine As String
FileOpen(1, "c:\test.pdf", OpenMode.Binary) ' Open file just created.
FileOpen(2, "c:\pdfTest.txt", OpenMode.Output)
Do While lngLocation < LOF(1) ' Loop until end of file.
strLine = InputString(1, 1) ' Read character into variable.
lngLocation = Loc(1) ' Get current position within file.
Print(2, lngLocation & " " & Replace(Replace(strLine, vbLf, "line feed"), vbCr, "carriage return") & vbCrLf)
Loop
FileClose(1) ' Close file.
FileClose(2)
End
End Sub
John | | JohnFL Monday, November 16, 2009 3:32 PM |
|