Fu.
Add the following function:
Code:
Public Shared Function ReadSpecifiedLine(ByVal file As String, ByVal lineNum As Integer) As String
'create a variable to hold the contents of the file
Dim contents As String = String.Empty
'always use a try...catch to deal
'with any exceptions that may occur
Try
Using stream As New StreamReader(file)
contents = stream.ReadToEnd().Replace(vbCr & vbLf, vbLf).Replace(vbLf & vbCr, vbLf)
Dim linesArray As String() = contents.Split(New Char() {ControlChars.Lf})
'Make sure we have ana ctual array
If linesArray.Length > 1 Then
'Make sure user didnt provide number greater than the number
'of lines in the array, and not less than 0 (zero) Thanks AdamSpeight2008
If Not lineNum > linesArray.Length AndAlso Not lineNum < 0 Then
Return linesArray(lineNum)
Else
'Failed our check so return the first line in the array
Return linesArray(0)
End If
Else
'No array so return the line
Return contents
End If
End Using
Catch ex As Exception
Return ex.ToString()
End Try
End Function
Code:
Dim s as string = reader.readtoend
Code:
DocName = ReadSpecifiedLine(s, 0)
DocLink1 = ReadSpecifiedLine(s, 1)
DocLink2 = ReadSpecifiedLine(s, 2)
Eating, fu again.