> ' Return the specific line in a string > ' expN1 Line > Public Function MLine(ByVal tnLine As Integer) As Boolean > Dim lnLocation As Integer = 0 > Dim loStringBuilderValueAdjusted As StringBuilder = New StringBuilder() > > ' If the line requested is greather than the number of lines > If tnLine > nLine Then > cLine = "" > Return True > End If > > ' If we are requesting the first ilne > If tnLine = 1 Then > > ' See if we have more than one line > If nLine > 1 Then > cLine = Mid(oStringBuilder.ToString, 1, InStr(oStringBuilder.ToString, oApp.cCR) - 1) > Else > cLine = oStringBuilder.ToString > End If > > Else > > ' Make sure we are able to find a carriage return > lnLocation = oApp.At(oApp.cCR, oStringBuilder.ToString, tnLine - 1) > If lnLocation > 0 Then > loStringBuilderValueAdjusted.Append(Mid(oStringBuilder.ToString, _ > oApp.At(oApp.cCR, oStringBuilder.ToString, tnLine - 1) + 2)) > > ' If this is not the last line > lnLocation = InStr(loStringBuilderValueAdjusted.ToString, oApp.cCR) > If lnLocation > 0 Then > cLine = Mid(loStringBuilderValueAdjusted.ToString, 1, _ > InStr(loStringBuilderValueAdjusted.ToString, oApp.cCR) - 1) > Else > cLine = loStringBuilderValueAdjusted.ToString > End If > > Else > cLine = oStringBuilder.ToString > End If > End If > > Return True > End Function >>
Function MLine(ByVal line As Integer, ByRef cLine As String) As Boolean Dim array As String() = s.Split(ControlChars.Cr) If line > array.Length Then cLine = String.Empty Return False Else cLine = array(line) Return True End If End Function(maybe needs a check for negative line)