Function Global_Table_Query([b]ByVal test As Predicate(Of ds2.JOINEDDATADataTable[/b])) As DataTable
ErrorMessage = ""
Dim dt As New DataTable
Dim Is_Good As Byte = 1
Dim thread As New Task(
Function()
Try
Dim lowNums = From row In Global_Table
[b]Where test
[/b] Select row
dt = lowNums.CopyToDataTable
Return dt
Catch ex As Exception
ErrorMessage = ex.Message
Return Nothing
Finally
End Try
End Function
)
Dim tasks() = {thread}
Array.ForEach(tasks, Sub(tx) tx.Start())
Task.WaitAll(tasks)
For Each tsk In tasks
Select Case True
Case tsk.IsCanceled
Is_Good = 1
Case tsk.IsFaulted
Is_Good = 1
Case tsk.IsCompleted
Is_Good = 0
Case Else
Is_Good = 1
End Select
Next
tasks = Nothing
thread = Nothing
'checking if something went wrong
If ErrorMessage <> "" Then
Is_Good = Nothing
Return Nothing
End If
Return dt
End Function
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.