Anyone know how I can accomplish this? I don't like how my program freezes when I'm loading a new map. Here's my attempt, can anyone tell me what I'm missing or what I should be reading up on?
Code:
Private Delegate Sub loadMapItem()
Private Sub Thread1Work()
Dim load As loadMapItem
Dim Result As IAsyncResult
load = New loadMapItem(AddressOf DelegateWork)
Result = AxMappointControl1.BeginInvoke(load)
Console.WriteLine("Thread 1 Done")
Console.WriteLine(Result.IsCompleted.ToString())
AxMappointControl1.EndInvoke(Result)
Console.WriteLine(Result.IsCompleted.ToString())
End Sub
Private Sub DelegateWork()
AxMappointControl1.Visible = False
AxMappointControl1.NewMap(1)
AxMappointControl1.Visible = True
Console.WriteLine("Delegate Done")
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Thread1 As Thread
Thread1 = New Thread(AddressOf Thread1Work)
Thread1.Start()
End Sub