I need to read a text file, find a line that contains "ComputerName=" then write this line to a string variable I can set to a label on my form. Does anyone have code for this?? Closest thing I have (which doesnt work) is coded:
VB.NET:
' Open file.txt with the Using statement.
Using r As System.IO.StreamReader = New System.IO.StreamReader("file.ini")
' Store contents in this String.
Dim line As String
' Read first line.
line = r.ReadLine
' Loop over each line in file, While list is Not Nothing.
Do While (line.Contains("ComputerName="))
' Add this line to list.
line.ToString(ComputerName)
' Read in the next line.
line = r.ReadLine
Loop
End Using
lblComputerName.Text = ComputerName