What is the vb.net equivalent of the following c# code?
var thread = new Thread(() =>
{
Dispatcher.CurrentDispatcher.BeginInvoke ((Action)(() => new MySplashForm().Show()));
Dispatcher.Run();
});
What is the vb.net equivalent of the following c# code?
var thread = new Thread(() =>
{
Dispatcher.CurrentDispatcher.BeginInvoke ((Action)(() => new MySplashForm().Show()));
Dispatcher.Run();
});
Depends on the version of VB.Net.
Dim thread As New Thread(
Sub()
Dispatcher.CurrentDispatcher.BeginInvoke (
Sub()
Dim form = new MySplashForm()
form.Show()
End Sub)
Dispatcher.Run()
End Sub)
Sub ShowForm()
Dim form = new MySplashForm()
form.Show()
End Sub
Sub CreateForm()
Dispatcher.CurrentDispatcher.BeginInvoke(AddressOf ShowForm)
Dispatcher.Run()
End Sub
Dim thread as New Thread(AddressOf CreateForm)
I'm not 100% sure what you're trying to achieve though. You are essentially creating another thread to asynchronously show a form but then immediately forcing the asynchronous operation. It seems like it would be a lot easier to just asynchronously show via BeginInvoke and abandon the idea of creating another thread.