Dennisaa

XThread02

Oct 3rd, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System.Windows;
  2.  
  3. namespace WpfCrossThread {
  4.  
  5.     public partial class MainWindow : Window {
  6.         private delegate void EnterTextDelegate();
  7.         public MainWindow() {
  8.             InitializeComponent();
  9.         }
  10.  
  11.         private void button_Click(object sender, RoutedEventArgs e) {
  12.             var del = new EnterTextDelegate(EnterText);
  13.             del.BeginInvoke(null, null);
  14.         }
  15.         private void EnterText() {
  16.            MyTextBox.Text = "this may make it fail";
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment