473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 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 1083

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

Similar topics

4
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; } } ...
0
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...
22
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...
9
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
1
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"...
0
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...
5
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...
5
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.