Here's the code:
public Form1()
{
string[] reader = File.ReadAllLines(@"F:\Bioshock2SP.ini");
foreach (string lines in reader)
{
if (lines.Contains("VoVolume="))
{
lines.Substring(lines.Length -2);
TextBox.Text = lines; //Exception
}
}
InitializeComponent();
}
I'm trying to find a line in a file and make only the actual setting part of the file show in the textbox. For example I want to find the line containing "VoVolume=55", but I only want, "55" to show in the textbox or even just, "1.534".
I keep getting an exception when I launch the program. Any ideas?
Exception Details:
NullReferenceException was unhandled.
An unhandled exception of type 'System.NullReferenceException' occurred in EditingTextFromFile.exe
Additional information: Object reference not set to an instance of an object.