Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question STRTOFILE in .Net Compatibility
Message
From
07/04/2010 15:39:54
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01459243
Message ID:
01459247
Views:
61
This message has been marked as a message which has helped to the initial question of the thread.
>1. Is there a function in .NET (C#) that works like the FileToStr?
>2. If so, will VFP StrToFile function be able to read that string value created in C# and still create the PDF?

Here it is:
        ' FileToStr() VFP equivalent
        ' expC1 File name
        Public Function FileToStr(ByVal tcFileName As String) As String
            Dim lcString As String = ""
            Dim lnCounter As Integer = 0
            Dim lnDelay As Integer = 500
            Dim lnRetry As Integer = 8
            Dim loFile As IO.StreamReader

            For lnCounter = 1 To lnRetry

                Try
                    loFile = New IO.StreamReader(tcFileName, True)
                    lcString = loFile.ReadToEnd()
                    loFile.Close()
                    Exit For

                Catch loError As Exception

                    ' If we have not reached the maximum tries of 8, we retry
                    If lnCounter < 8 Then

                        ' Wait for a timeout before retrying
                        System.Threading.Thread.Sleep(lnDelay)

                        Continue For
                    End If

                    ' Get the proper definition as per the current scope
                    If oProcess Is Nothing Then
                        oApp.ErrorSetup(loError, tcFileName)
                    Else
                        oProcess.ErrorSetup(loError, tcFileName)
                    End If

                End Try

            Next

            Return lcString
        End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform