472,364 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

How can i run a new form in a panel or usercontrol?

Hi everyone, i need some help with a tabbed interface.

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
  1.  Dim t As Threading.Thread
  2.     t = New Threading.Thread(AddressOf ShowForm2)
  3.     t.Start()
here is the ShowForm2 function
Expand|Select|Wrap|Line Numbers
  1. Private Sub ShowForm2()
  2.         Dim frmNew As New FORM
  3.         frmNew.TopLevel = False
  4.         Application.Run(frmNew)
  5.         Me.Invoke(New AddTabCallback(AddressOf Addtab), frmNew)
  6.     End Sub
and here is the code for adding a new form

Expand|Select|Wrap|Line Numbers
  1. Private Sub Addtab(ByRef tab As Form)
  2.         Me.Controls.Add(tab)
  3.         End Sub
this is the delegate declaration :
Expand|Select|Wrap|Line Numbers
  1. Public Delegate Sub AddTabCallback(ByRef tab As Form)
the problem is when i use Application.run(frmNew) , the form is created but is not visible on the usercontrol. Is visible on the threads area on visual studio

if i choose to remove the application.run(frmNew) and on sub addtab to add the folowing:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Addtab(ByRef tab As Form)
  2.         Me.Controls.Add(tab)
  3. tab.show()
  4.         End Sub
in this way the form is visible on usercontrol but is created on the main thread and i don't want that to happen.
Is there a way to use application.run() or other solution to launch the form in a usercontrol?

Thanks alot
Oct 25 '09 #1
0 1026

Sign in to post your reply or Sign up for a free account.

Similar topics

by: james | last post by:
I cannot get my UserControl's browsable properties to show up in the designer properties panel. I have then public virtual bool TestProp { {get return testProp; } set { testProp = value; } } ...
by: Benjamin Bittner | last post by:
Hallo NG, ive searched a lot in some google groups, and found many threads, but nothing that helped me. Here is the scenario: I have an aspx page which loads a user control in page.onInit like...
by: Woody Splawn | last post by:
I am somewhat new to VS.net in general. As a result I am prone to make mistakes. When adding some new feature to a a form it would be nice if I could back it up before trying something that might...
by: Quina | last post by:
Hi. Is there someone that can tell me how can I have multiple screens on the the same form, displaying only on at the time? Thank you all for any replys. Joćo Carias
by: TheSteph | last post by:
Hi ! I would like to create a UserControl that act as a « Collapsible Panel ». So I have a UserControl with two panels : a "Header panel" at the top, and a "Container Area Panel"...
by: Didier Bolf | last post by:
hello I use the framework2.0 When you have a Form which contains a usercontroll which contains a splitcontainer which contains a TreeView in the left panel of the splitcontainer. Then when...
by: marfi95 | last post by:
I have a form that has a left and right panel. In the left panel is a treeview. The right panel I want to change dynamically based on the type of node selected. What I'm doing is loading the...
by: =?Utf-8?B?cm9nZXJfMjc=?= | last post by:
hey, how do I take form code and put it into separate classes? more specifically, I want to create like a panel class, and put buttons in it and give these buttons click events. and all my form...
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I have a situation where I need to display a form in a panel. Everything works great except if the form is maximized and the panel's size changes. In this case the maximized form's bounds do not...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.