I want to implement threading in VB.net. Here I want to use ThreadPool.QueueUserWorkItem() method.
Example:
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf TaskA), AIsDone)
My Code:
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf CType(tempControl, ReportletBase).GetReportData), Nothing)
Code block:
Try
'Load the ascx control within the TD cell
tempControl = Me.LoadControl("~/Reportlets/" & CStr(reportlet.id) & ".ascx")
----> ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf CType(tempControl, ReportletBase).GetReportData), Nothing)
CType(tempControl, ReportletBase).Position = position
CType(tempControl, ReportletBase).ReportToBeLoadedIn = m_proxy.Report
reportlePlaceholder.Controls.AddAt(reportlePlaceholder.Controls.Count, tempControl)
Catch ex As System.Exception
Description:
tempControl: variable holding references of user controls of type ReportletBase (base Class)
GetReportData(): It is main method in each user control class that inherits ReportletBase class. We want to implement multi-thread
on this method
Problem/Error:
Method 'Public MustOverride Function GetReportData() As System.Collections.Hashtable' does not have a signature compatible with delegate 'Delegate Sub WaitCallback(state As Object)'.
Here GetReportData() has return type as Hashtable - How to embedd this with delegate use in above code