Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows;
- using System.Diagnostics;
- namespace WpfCrossThread {
- public partial class MainWindow : Window {
- private delegate void EnterTextDelegate();
- public MainWindow() {
- InitializeComponent();
- }
- private void button_Click(object sender, RoutedEventArgs e) {
- var del = new EnterTextDelegate(EnterText);
- del.BeginInvoke(null, null);
- }
- private void EnterText() {
- try {
- MyTextBox.Text = "this may make it fail";
- } catch (Exception e) {
- EventLog.WriteEntry("Application", e.Message);
- throw;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment