Hello All,
I am working with a program the reads data from a file and plots it to a graph in real time. My stream is coming from a microcontroller output and I am building an interface to display the data. I am using stream reader in my routine, but I have a problem.
What I want to do is to get one line, plot it, and the get the next line inside a method. Can you please direct me as to what to use to do this. I am new to C# and I think stream reader is the best way to do this. I just need a way of being able to read new points as they come.
Thanks'
private void timer1_Tick( object sender, EventArgs e )
if ( curve == null )
return;
IPointListEdit list = curve.Points as IPointListEdit;
if (list == null)
return;
double time = (Environment.TickCount - tickStart) / 1000.0;
try
{
//PROBLEM (NEED TO READ ONE LINE THIS TIME AND THE NEXT LINE IN THE NEXT CALL
StreamReader sr = new StreamReader("TestFile.txt");
String line;
line = sr.ReadLine();
double value = double.Parse(line);
list.Add(time, value);
}
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
//graphing code
}