I have a readstream opened in a form. I'm reading from that stream and sending text to another form's textbox . i want the text to be updated to the textbox as soon the text arrives in readstream.
code in first form:->
f2.ShowDialog(); //f2 is second form's object
while (true)
{
string inp_msg = sr.ReadLine();
f2.set_text(inp_msg);
this.Refresh();
}
set_text function defined in second form:->
public void set_text(string msg)
{
//MessageBox.Show(msg);
textBox1.Text = textBox1.Text + msg + "\r\n";
//Application.DoEvents();
}
the problem is that the textbox is not updating .