Click here to Skip to main content
15,920,633 members
Home / Discussions / C#
   

C#

 
GeneralRe: Copy or read locked/in use files Pin
nemopeti31-May-06 21:34
nemopeti31-May-06 21:34 
GeneralRe: Copy or read locked/in use files Pin
stancrm31-May-06 21:50
stancrm31-May-06 21:50 
GeneralRe: Copy or read locked/in use files Pin
nemopeti31-May-06 23:41
nemopeti31-May-06 23:41 
GeneralRe: Copy or read locked/in use files Pin
stancrm31-May-06 23:47
stancrm31-May-06 23:47 
GeneralRe: Copy or read locked/in use files Pin
nemopeti31-May-06 23:54
nemopeti31-May-06 23:54 
QuestionIs it a correct way Pin
engsrini31-May-06 20:43
engsrini31-May-06 20:43 
AnswerRe: Is it a correct way Pin
BadKarma31-May-06 21:33
BadKarma31-May-06 21:33 
AnswerRe: Is it a correct way Pin
InOut.NET31-May-06 21:57
InOut.NET31-May-06 21:57 
If i understand you correctlly, you acctaully want a MDI-alike interface without the forms.

I've done the same thing (but with MDI forms) and found that a control/form should not unload itself. I prefer a "control marchall" in the main form that cooridnates the creation and disposal of the controls. I use this approach and gives my comlete control over the opened controls. The main form hold the custom control object, and main form can access it when something within the mainform changes and affects the currentlly open controls. The control/form communicates with the mainform using events and mainform cummunicates with the custom control trough public methods. Perfectly 2-way comm bewteen the 2 objects while none is dependant on the other.

engsrini wrote:
when i click cancel on user control it should remove itself from panel and should load the next user control.


I use a event that thats fires within the contol when the cancel button is pressed. OnControlRequestClose(object sender).
This event is consumed by the control marchall in the main form and the control marchall then calls the public methods that stop threads running on the control and then safelly control.close();
I your case you can control the next control order from a central entity.

Both your appraches are feasible, but having a marchalling entity makes it so more flexible. The reason i took this road is that my mainform acts as a central management entity that does Audit trails, indicate network comms, log files, handle form malfunctioning and a few more functions that is commonly used troughout my system. I hate copying and pasteing the same code in each form, thus i use the central entity with a combonation of events and custom delegates.

This works fine for me. No refrence of the main form goes to the control. The main form however must 'know' the type of the custom control.




My opinion,
Andre
Questioncombobox Pin
kjosh31-May-06 20:28
kjosh31-May-06 20:28 
AnswerRe: combobox Pin
InOut.NET31-May-06 22:11
InOut.NET31-May-06 22:11 
QuestionHelp on P/Invoke BSTR* Pin
bluish31-May-06 20:08
bluish31-May-06 20:08 
AnswerRe: Help on P/Invoke BSTR* Pin
rah_sin31-May-06 20:13
professionalrah_sin31-May-06 20:13 
GeneralRe: Help on P/Invoke BSTR* Pin
bluish31-May-06 20:22
bluish31-May-06 20:22 
AnswerRe: Help on P/Invoke BSTR* [modified] Pin
stancrm31-May-06 20:27
stancrm31-May-06 20:27 
Questionupdating and retriving image Pin
leelaraj31-May-06 20:03
leelaraj31-May-06 20:03 
AnswerRe: updating and retriving image Pin
Laubi1-Jun-06 2:19
Laubi1-Jun-06 2:19 
GeneralRe: updating and retriving image Pin
leelaraj2-Jun-06 19:47
leelaraj2-Jun-06 19:47 
QuestionAdding Design script to script component in SSIS using C# Pin
Tarsha31-May-06 19:31
Tarsha31-May-06 19:31 
QuestionUrgent Pin
Shiv531-May-06 17:54
Shiv531-May-06 17:54 
AnswerRe: Urgent Pin
rah_sin31-May-06 18:21
professionalrah_sin31-May-06 18:21 
AnswerRe: Urgent Pin
_AK_31-May-06 18:31
_AK_31-May-06 18:31 
AnswerRe: Urgent Pin
nandank8131-May-06 18:56
nandank8131-May-06 18:56 
Questionwhat is the C# equivalent of PHP crypt() function Pin
Srivalli31-May-06 14:07
Srivalli31-May-06 14:07 
AnswerRe: what is the C# equivalent of PHP crypt() function Pin
Christian Graus31-May-06 15:06
protectorChristian Graus31-May-06 15:06 
Questionhow to create a FillReversibleRectangle blue? Pin
Susuko31-May-06 13:59
Susuko31-May-06 13:59 

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.