Hi.
I'm trying to load and put a form to an MDI parent.
Whatever I try, the loading child form will halt the UI of the parent form.
The main loading functions are on the frmchild.show() aka frmchild.Load .
Is there anything that can be done except running the child load even async?
This slows the execution:
This worked once, possibly I got it on invocation but it halted the mdi form again , after that I get cross thread exception:
This slows the execution:
I've read that maybe if you put work workload on sub new but I can't do that as I I need heavy controlling manips.
What I'm thinking, if everything else fails is to have an async function inside the child Load, but that will take me a week to do so.
But OK if there is no other way...
Thanks.
I'm trying to load and put a form to an MDI parent.
Whatever I try, the loading child form will halt the UI of the parent form.
The main loading functions are on the frmchild.show() aka frmchild.Load .
Is there anything that can be done except running the child load even async?
This slows the execution:
Code:
Dim thr As New Threading.Thread(AddressOf addmoremdis)
thr.Start()
Sub addmoremdis()
Dim dlg As New add_mdi(AddressOf addmdi)
Dim frr As New FrmProChild
frr.PC = "192"
Me.Invoke(dlg, New Object() {frr})
End Sub
Delegate Sub add_mdi(ByVal frm As Form)
Sub addmdi(ByVal frm As Form)
frm.MdiParent = Me
frm.Show()
End Sub
Code:
Dim frr As New FrmProChild
frr.PC = "192"
frr.MdiParent = Me
BackgroundWorker1.RunWorkerAsync(frr)
Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim formInstance As Form = CType(e.Argument, Form)
Try
' I can do that but what's the point, it will slow'
' Me.InvokeIfRequired(Sub()
' formInstance.Show()
' End Sub)
formInstance.Show()
Catch ex As Exception
End Try
End Sub
Code:
frr.BeginInvoke(New MethodInvoker(AddressOf frr.Show))
What I'm thinking, if everything else fails is to have an async function inside the child Load, but that will take me a week to do so.
But OK if there is no other way...
Thanks.