Hi,
I am using delegates and Invokerequired to marshal to the UI a call to my UI update function. However, despite using this usual scenario, my UI still freezes. Here is my code:
Please help me find out what is it that I am doing wrong here.. Thanks
I am using delegates and Invokerequired to marshal to the UI a call to my UI update function. However, despite using this usual scenario, my UI still freezes. Here is my code:
VB.NET:
Public Delegate UIDelegate
Private Sub ShowReport()
If Me.InvokeRequired Then
Dim newDelegate As New UIDelegate(AddressOf ShowReport)
Me.BeginInvoke(newDelegate)
Else
Dim rpt as CrystalDecisions.CrystalReports.Engine.ReportDocument
rpt = new myCrystalReport 'A CrystalReport report in my project
Me.CrystalReportViewer1.ReportSource = rpt
End If
End Sub
Private Sub GO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GO.Click
Dim t As New Thread(New ThreadStart(AddressOf ShowReport))
t.IsBackground = True
t.Start()
End Sub
Please help me find out what is it that I am doing wrong here.. Thanks