' Return the number of lines in a string ' expC1 String Public Function MemLines(ByVal tcValue As String) As Integer Dim lcValue As String = "" Dim lnLine As Integer = 0 lcValue = tcValue lnLine = oApp.Occurs(oApp.cCR, lcValue) + 1 Return lnLine End Function ' Return the specific line in a string ' expC1 String ' expN1 Line Public Function MLine(ByVal tcValue As String, ByVal tnLine As Integer) As String Dim lcLine As String = "" Dim lcValue As String = "" Dim lcValueAdjusted As String = "" Dim lnLine As Integer = 0 Dim lnLocation As Integer = 0 lcValue = tcValue lnLine = oApp.Occurs(oApp.cCR, lcValue) + 1 ' If the line requested is greather than the number of lines If tnLine > lnLine Then Return "" End If ' If we are requesting the first ilne If tnLine = 1 Then ' See if we have more than one line If lnLine > 1 Then lcLine = Mid(lcValue, 1, InStr(lcValue, oApp.cCR) - 1) Else lcLine = tcValue End If Else ' Make sure we are about to find a carriage return lnLocation = oApp.At(oApp.cCR, lcValue, tnLine - 1) If lnLocation > 0 Then lcValueAdjusted = Mid(lcValue, oApp.At(oApp.cCR, lcValue, tnLine - 1) + 2) ' If this is not the last line lnLocation = InStr(lcValueAdjusted, oApp.cCR) If lnLocation > 0 Then lcLine = Mid(lcValueAdjusted, 1, InStr(lcValueAdjusted, oApp.cCR) - 1) Else lcLine = lcValueAdjusted End If Else lcLine = "" End If End If Return lcLine End FunctionWhen I did it, the goal was to simulate the VFP function in .NET. I see you could use something out of it.