I have this scenario:
1 Main Form
1 UserControl
1 Form
when main form is loaded the Usercontrol load ..
In the _load handler i want to open then Form in separate thread
here is my _load handler for usercontrol:
Expand|Select|Wrap|Line Numbers
- Dim t As Threading.Thread
- t = New Threading.Thread(AddressOf ShowForm2)
- t.Start()
Expand|Select|Wrap|Line Numbers
- Private Sub ShowForm2()
- Dim frmNew As New FORM
- frmNew.TopLevel = False
- Application.Run(frmNew)
- Me.Invoke(New AddTabCallback(AddressOf Addtab), frmNew)
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub Addtab(ByRef tab As Form)
- Me.Controls.Add(tab)
- End Sub
Expand|Select|Wrap|Line Numbers
- Public Delegate Sub AddTabCallback(ByRef tab As Form)
if i choose to remove the application.run(frmNew) and on sub addtab to add the folowing:
Expand|Select|Wrap|Line Numbers
- Private Sub Addtab(ByRef tab As Form)
- Me.Controls.Add(tab)
- tab.show()
- End Sub
Is there a way to use application.run() or other solution to launch the form in a usercontrol?
Thanks alot