I am using some tasks to do some operation and meantime i am showing user additional 'waiting form' then when task's function is finished welcome form s closing from the task. I have already solution and it was discussed in this topic: enter link description here
Now the problem is i wanted to implement it in some other place and i face issue that my waiting form is still on place (not being closed) and i have no idea why. What i can say is i checked if function is retreiving value - it is for sure. I suppose that this is because function is finishing before Welcome form is showing up therefore it stacks... Is there anyway to check if that the case? That's the code:
Dim pic As New Waiting
Dim tsk As Task(Of Boolean) = Task.Factory.StartNew(Function()
'--Run lenghty task
'--Show the form
pic.ShowDialog()
Dim retValue As Boolean = THIS_UpdateTransport()
'--Close form once done (on GUI thread)
pic.Invoke(New Action(Sub() pic.Close()))
Return retValue
End Function)
'--Show the form
pic.ShowDialog()
Task.WaitAll(tsk
)