Guest User

Untitled

a guest
Aug 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. //create a delegate
  2. delegate void AddToTextBoxDelegate(ref TextBox textBox1, string text);
  3.  
  4. //create a function which the delegate will use
  5. private void AddToTextBox(ref TextBox textBox1, string text)
  6. {
  7.     textBox1.Text += text;
  8. }
  9.  
  10. //use the delegate
  11. name_of_your_textbox.Invoke(new AddtoTextBoxDelegate(UpdateTextBox), new object[] { ref name_of_your_textbox, string_to_write_into_your_textbox });
Add Comment
Please, Sign In to add comment