Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi to all of you, this is my first post on Code Project and I need help and/or ideas on how to implement a user control that would have a modal behavior.
 
My only problem is that I CAN'T be using any kind of form.
 
I already try this approach and it is not doing what we need it to do.
 
Our problem is that the application we are developing with C# 3.0 is a full screen application with security to enforce the user to stay in the application.
 
We are not using other forms because it would force the taskbar to appear and disable the main security of the parent full screen form.
 
So everything in the main form is a user control.
 
If you happen to know that this is not possible, could you simply elaborate a little more to explain with this is not possible.
 
Thanks for you're help and you're answer, cheer.
Posted 15-Sep-12 3:53am
Comments
Wes Aday at 15-Sep-12 9:02am
   
"I CAN'T be using any kind of form", so what kind of container capable of containing user controls are you using?
Philippe Mercure at 15-Sep-12 9:20am
   
No I am using a form for the main form, but I cannot put the user control that we want to be modal in a new form and then just show this form. It need to be a user control in the main form with a modal behavior, sorry for the misunderstood.
Wes Aday at 15-Sep-12 9:24am
   
Sorry that makes no sense to me. Trying to use a modal form without using a modal form sounds like a poor design to me. Maybe someone else has some other ideas. Good luck.
Philippe Mercure at 15-Sep-12 9:29am
   
Ok maybe try it another way around, you need to create a full screen application with security to disable the start menu Alt+Tab and stuff like this. We already create a bunch of user control, but all of them are being use at the same time, like a UserControlClock and a UserControlDate. With all those user control we now need to ask the user if he want to delete or not something, basically we need the user to answer a question, Yes No. How would you do if you were not able to create a new form. Their must be a way with event, delegation, timer or a mix of them, to assure you that the user select Yes or No, before the main form can continue it execution.
Wes Aday at 15-Sep-12 9:31am
   
That exact thing that you are describing is called a MessageBox
Philippe Mercure at 15-Sep-12 9:37am
   
Mmmm, ok, so we might not have a choice but use a custom form in modal mode. I was trying to avoid this. I'll try to limit the impact. Thanks for you help, :).
Ed Nutting at 15-Sep-12 9:29am
   
Your question is very unlcear at the moment and really doesn't make much sense. Please use the Improve Question link above to create a re-worded version of it. Perhaps get a colleague to look it over or something?
 
Thanks,
Ed
Philippe Mercure at 15-Sep-12 9:32am
   
Could you elaborate on what is not clear, ???
Ed Nutting at 15-Sep-12 9:39am
   
Erm.. all of it? You start by saying you can't use any kind of Form but then say that you are using a Form for your Main Form - that doesn't make sense. Then you say that you want to put a User Control in a Form but not using a Form - really confused here.
 
I suggest you listen to Wes Aday, he is right when he says you should use a MessageBox (with Yes/No button options used not default buttons - see MSDN documentation). This shouldn't show the Task Bar.
 
I would just like to point out though that all your efforts are defeated by one simple fact - you cannot disable Ctrl+Alt+Delete! Any user could just Ctrl+Alt+Delete and get out of your program without too much difficulty. Edit: Unless your company will be disabling many of the useful Ctrl+Alt+Delete features, notably Task Manager, on every client computer.
 
Ed
Philippe Mercure at 15-Sep-12 9:44am
   
Yes that's what we are doing with the Ctrl+Alt+Delete, thanks for you help, I'll try to be using the MessageBox, if I found another solution I'll try to post it here, thanks again, :).

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I found the solution to my problem, to have a UserControl have the behavior of a modal form.
 
It was pretty easy.
 
Just by using event handlers, I was able to hook up to the UserControl Yes and No button, then by displaying this UserControl full screen on the main form, would act like a modal form.
 
Thanks all for you're help, Smile | :) .
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 450
1 OriginalGriff 180
2 DamithSL 130
3 Dave Kreskowiak 120
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,645
1 DamithSL 5,614
2 Sergey Alexandrovich Kryukov 5,344
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 15 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100