Action<string, TextBox> actionAddTxtDelegate = (x, y) =>
{
y.AppendText(x.ToString() + "\r\n");
y.ScrollToCaret();
};
Action<string, TextBox> actionUpdateTxtDelegate = (x, y) =>
{
string[] lines = y.Lines;
if (lines.Length > 0)
{
lines[lines.Length - 2] = x;
}
y.Lines = lines;
y.ScrollToCaret();
};
public void UpdateTxt(string txt)
{
this.textBox1.BeginInvoke(actionUpdateTxtDelegate,txt,this.textBox1);
}
public void AddTxt(string txt)
{
this.textBox1.BeginInvoke(actionAddTxtDelegate ,txt,this.textBox1);
}