meine Sys/Db admin & Developper Notitzen - wer Rechtschreibfehler findet darf sie behalten ... my Sys/Db Admin and developper notes - I don't care about typos
Sunday, July 22, 2012
windows form textbox.text threadsicher setzten
/// used To set Text Box Threadsave (Invoked by this MoneyManagerForm)
///
/// Textbox to set text
/// text is set to Textbox
private delegate void DelegateSetTbText(TextBox tb, string s);
/// threadsave set of Text of Textbox
///
/// Text of this Textbox is set
/// new text for textbox
private void SetText(TextBox tb, string text)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (this.InvokeRequired)
{
DelegateSetTbText d = new DelegateSetTbText(SetText);
this.Invoke(d, new object[] { tb, text });
}
else
{
tb.Text = text;
tb.Enabled = true;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment