//File:Window.xaml.vb Imports System.Windows Imports System.Windows.Threading Namespace WpfApplication1 Public Partial Class Window1 Inherits Window Private Delegate Sub CheckAccessDelegate() Private Delegate Sub SetResultTextDelegate(result As String) Public Sub New() InitializeComponent() End Sub Private Sub ButtonTrue_Click(sender As Object, e As RoutedEventArgs) CheckAccess() End Sub Private Sub ButtonFalse_Click(sender As Object, e As RoutedEventArgs) Dim del As New CheckAccessDelegate(AddressOf CheckAccess) del.BeginInvoke(Nothing, Nothing) End Sub Private Overloads Sub CheckAccess() If txtResult.Dispatcher.CheckAccess() Then txtResult.Text = "True" Else txtResult.Dispatcher.BeginInvoke(DispatcherPriority.Normal, New SetResultTextDelegate(AddressOf SetResultText), "False") End If End Sub Private Sub SetResultText(result As String) txtResult.Text = result End Sub End Class End Namespace