I have used a timer to run through a string
, I have used a while
too but I am wondering is there a faster way. I have string that contains date serial number, the date is always after the text d|
private void Timer1_Tick(object sender, EventArgs e)
{
string caldata = textBox6.Text;
textBox7.Text = caldata.Length.ToString();
if (caldata.Substring(0, 2) == "d|")
{
// MessageBox.Show("Found date" + caldata.Substring(2, 5));
listBox1.Items.Add(caldata.Substring(2, 5));
textBox6.Text = caldata.Remove(0, 7);
caldata = textBox6.Text;
}
else
{
textBox6.Text = caldata.Remove(0, 1);
caldata = textBox6.Text;
}
if (caldata.Length < 4)
{
timer1.Enabled = false;
}
}
My string that contains the data looks like the attached.