Click here to Skip to main content
15,916,042 members
Home / Discussions / C#
   

C#

 
AnswerRe: Sorting in multiple columns in gridview using C# Pin
Luc Pattyn25-Oct-11 10:18
sitebuilderLuc Pattyn25-Oct-11 10:18 
QuestionDeployment of c# application with merge modules Pin
sarang_k24-Oct-11 20:49
sarang_k24-Oct-11 20:49 
AnswerRe: Deployment of c# application with merge modules Pin
Pete O'Hanlon24-Oct-11 21:05
mvePete O'Hanlon24-Oct-11 21:05 
QuestionDynamically placing Forms onto TabControl Pages - need to add threading Pin
boreland24-Oct-11 13:29
boreland24-Oct-11 13:29 
AnswerRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
Luc Pattyn24-Oct-11 14:19
sitebuilderLuc Pattyn24-Oct-11 14:19 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
boreland24-Oct-11 17:48
boreland24-Oct-11 17:48 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
BobJanova24-Oct-11 23:04
BobJanova24-Oct-11 23:04 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
BillWoodruff25-Oct-11 3:20
professionalBillWoodruff25-Oct-11 3:20 
There has never been a 'myth' that you could not put a WinForm inside other Container objects' Controls Collection ... as long as you set the TopLevel property to 'false.

Yes, you are 'free' to create things as weird as a Form inside a TextBox:
Form2 f2 = new Form2();
f2.TopLevel = false;
textBox1.Controls.Add(f2);
f2.Show();
And, ready the bell, book, and candle, you can even do this:
Form2 f2 = new Form2();
f2.TopLevel = false;
f2.Parent = textBox1;
f2.Show();
But the interesting question is: why you would want to use a Form inside another container in the first place.

I stand ready for you to illuminate me on that, and I'd be happy to learn my assumptions are incorrect !

A WinForm is not a "light-weight object." And UserControls and Panels ... and later .NET additions like FlowLayoutPanel and TableLayoutPanel ... at least Panel and UserControl being much lighter-weight than a Form ? ... are really the "designated hitters" for use as containers of Controls within Forms, or other container controls.

A UserControl, or a Panel, can actually have size co-ordinates larger than the effective screen resolution: a Form cannot. Forms come with a baggage of adorner buttons (Max, Min, ControlBox), and various properties and methods, you will probably not need when one is used inside another Control.

In case someone trots out old the old war-horse, MDI architecture on this thread as a case for Forms inside a Form: rest-in-peace, MDI. Your gargoylish time came and went, and, for your time, you were, perhaps like Quasimodo in "The Hunchback of Notre Dame," necessary to ring some bells, but, sorry, we got new-fangled carillons these days that look a lot smarter.

We got 'TopMost' to make floating windows now, say halleleujah !

I don't pretend to understand what you are doing with threading in your code, but it looks like an interesting experiment. My one question would be that if you are using the standard Program.cs method of launching the app by creating an instance of a primary Form: when the user closes that primary Form, which normally auto-shuts-down all other created Forms ... and you've got this child-form which you voodoo'd to make run in a separate thread: what happens to that own-thread child-form ? Does the thread terminate properly ? Is the child-form window closed as usual ?

I hope I don't sound critical here: I have a history of learning/exploring technology by 'tormenting' structure, and 'pushing the envelope' to see what happens, myself Smile | :)

One of my favorite experiments, years ago, was a collection of sticky-notes (individual Forms) that ... in reponse to a certain key-stroke combination on any of the sticky-forms ... 'collapsed' into a single Form with a TabControl, where all the Controls in each sticky-Form appeared in separate TabPages, each titled with the name of the sticky-Form. But ... I remained pure ... and the TabPages were not violated by Forms Smile | :)

And then, you typed the same keystroke combination on this Main Form and it was made invisible, and all the sticky-Forms were 'exploded,' shown again, restored to their last location: fun !

By the way, there are some interesting things done with multiple AppDomains in a WinForm project in Chris Sells' book on WinForms from Addison-Wesley, on which I was a technical-editorial consultant ... I think they might interest you.

best, Bill
"Last year I went fishing with Salvador Dali. He was using a dotted
line. He caught every other fish." Steven Wright

GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
boreland25-Oct-11 3:53
boreland25-Oct-11 3:53 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
Pete O'Hanlon25-Oct-11 4:10
mvePete O'Hanlon25-Oct-11 4:10 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
BillWoodruff25-Oct-11 14:53
professionalBillWoodruff25-Oct-11 14:53 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
boreland25-Oct-11 15:49
boreland25-Oct-11 15:49 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
BillWoodruff25-Oct-11 17:51
professionalBillWoodruff25-Oct-11 17:51 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
boreland25-Oct-11 19:29
boreland25-Oct-11 19:29 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
Pete O'Hanlon26-Oct-11 3:23
mvePete O'Hanlon26-Oct-11 3:23 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
BobJanova26-Oct-11 0:35
BobJanova26-Oct-11 0:35 
GeneralRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
BobJanova26-Oct-11 0:34
BobJanova26-Oct-11 0:34 
AnswerRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
BillWoodruff25-Oct-11 18:01
professionalBillWoodruff25-Oct-11 18:01 
AnswerRe: Dynamically placing Forms onto TabControl Pages - need to add threading Pin
boreland7-Nov-11 13:39
boreland7-Nov-11 13:39 
Question2010 C# linq Pin
dcof24-Oct-11 12:28
dcof24-Oct-11 12:28 
AnswerRe: 2010 C# linq Pin
Not Active24-Oct-11 12:57
mentorNot Active24-Oct-11 12:57 
QuestionPoint conversion. Pin
paper6724-Oct-11 8:05
paper6724-Oct-11 8:05 
AnswerRe: Point conversion. Pin
Eddy Vluggen24-Oct-11 8:34
professionalEddy Vluggen24-Oct-11 8:34 
AnswerRe: Point conversion. Pin
Luc Pattyn24-Oct-11 9:09
sitebuilderLuc Pattyn24-Oct-11 9:09 
GeneralRe: Point conversion. Pin
Keith Barrow24-Oct-11 9:11
professionalKeith Barrow24-Oct-11 9:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.