|
|
Hi all,
I've got a C# WinForms application where the top-level form displays a modal dialog to allow the user to set some options. I create it very simply as follows:
using (MyForm form = new MyForm())
{
form.ShowDialog(this);
}
I've turned off the ShowInTaskbar property for the dialog, so it doesn't show up in the taskbar. However, if you press Alt-Tab, it appears in the window list. That itself is not too much of a problem (it just looks bad and can be a little annoying if you're trying to switch between two apps).
However, you can use Alt-Tab to switch back to the parent form even though it is currently showing the modal dialog. I'm unable to use the mouse to do anything with the parent form, BUT I can use keyboard accelerators to use menus on the parent form (with bad consequences). I've worked around this by explicitly disabling and enabling the parent form while displaying the dialog.
So I have two questions:
1) Any ideas for how I can stop my modal dialog appearing in the Alt-Tab window list? I presume it appears there because it is a top-level form, but .NET doesn't seem to like showing non-top-level forms as modal dialogs.
2) Is the approach of disabling and enabling the parent the best approach here? Or am I just missing something obvious?
Thanks,
Dave
|
|
|
|
|
The only keyboard shortcut that Microsoft allow you to disable, by a happy chance, is alt+tab.
Set alt+tab as a key combination, and have the response to it be a
System.Windows.Forms.MessageBox.Show("I am offended by your choice to switch to another program")
About the lock thing-use an if() to disable the shortcuts in the parent until the child is closed!
All of my programs are downloadable at fahadsadah.co.nr
|
|
|
|
|
I was thinking more along the lines of not showing the dialog in the alt-tab list in the first place, rather than preventing alt-tab use altogether - that would be extremely annoying to some people.
|
|
|
|
|
It would indeed, and I must admit I hadn't noticed that a C# modal dialog created its own window in the Alt-Tab list. It looks like I've got some fixing to do (once you figure out what the cause is).
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi Pete,
This blog[^] calls it a bug in Windows XP PowerToy Task Switcher.
And it fits with my experience:
- regular Alt-Tab works as expected;
- PowerToy shows both form and its modal dialog whatever properties you set.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Ah. Glad I haven't lost my mind. Thanks for link.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I'm using System.Configuration.ConfigurationSettings, and it says the class is depreciated, and to use System.Configuration.ConfigurationManager (or something like that..) .. However, when I try and use the newer one, it says it doesn't exist. So I am forced to use the depreciated class. Which isn't a problem, everything still works. I just was curious as to what was going on.
|
|
|
|
|
Did you add a reference to system.configuration.dll?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I have "using system.configuration;"
|
|
|
|
|
And you need a reference to System.Configuration.dll
|
|
|
|
|
Added a reference, Still dont have any System.Configuration.ConfigurationManager.AppSettings. Which is what its saying System.Configuration.ConfigurationSettings.AppSettings was replaced by. :/
|
|
|
|
|
http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx[^]
ConfigurationManager Class
Provides access to configuration files for client applications. This class cannot be inherited.
Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)
Wierd, it definatly lives there in the framework. Just for sanitys sake could you try creating a compleatly new project in a solution, adding that reference and try to access ConfigurationManager?
|
|
|
|
|
Still doesn't work. Maybe my company doesn't have the latest updates for VS installed? *shrug*
|
|
|
|
|
What version of Visual Studio are you using?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I know this is not related to programming, but here goes:
I have a program that requires .Net framework 1.1.4322 to be installed, while I have the latest 3.5 beta from VS Orcas.
Is there any way to trick the program into accepting my computer?
All of my programs are downloadable at fahadsadah.co.nr
|
|
|
|
|
Sure, you could. But then your app would probably fall on it's face anyway since there are breaking changing between .NET 1.1 and 2.0 and 3.0 and 3.5...
Just download and install the .NET 1.1 Redistributable and save yourself that hassle of trying to "force" the thing to work.
All versions of the .NET Framework can be installed side-by-side with no problems. You can install 1.0, 1.1, 2.0, 3.0, and 3.5 all at the same time...
|
|
|
|
|
Thank you very much!
All of my programs are downloadable at fahadsadah.co.nr
|
|
|
|
|
Dave Kreskowiak wrote: save yourself that hassle of trying to "force" the thing to work
Kind of like pounding a square peg through a round hole :->
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
HI,
Here i'm new to .net and need to develope good notes and graphical tool for
newbies in dotnet so the student can get clear idea of framework and also can recall important things quickly.
I just need to know a simple ebook which help me in getting all .net basics
like what is class,struct,interface,abstract class and all.
Please let me know any link or else as early as possible.
i will also like to have a list of different categories with details, such as
databind controls, different editing controls , different types of controls with its uses such as listview,datagrid,combo,etc
please let me know any link or material you know...
Thanks in advance.
Setram Bhardwaj
Software Enginer
|
|
|
|
|
Hi Setram,
Try learning all of these basics from MSDN itself. Here is a link from where you may start:
http://msdn2.microsoft.com/hi-in/library/default.aspx
Otherwise, you can search for Free Tutorials on .NET and I am sure you will get loads of information.
Regards,
Amit Pal
|
|
|
|
|
Hi everyone ,
Which of the following approach is more suggestible - nested if or a do - while with break statement , while performing large number of validations
|
|
|
|
|
these two suggestions are usually for totally different situations.. a nested if has no repetition, unlike a do/while loop.. using a do/while loop just for validation (with no need for repetition) seems like a bad idea..
provide some more details as to what your looking for.. also, have you considered case statements?
|
|
|
|
|
Hello,
I am running a Web Application on C#.
I have a site with a dedicated IP address - say xx.xx.xxx.xx
Now the application running on the server is made to fetch a URL request - from a site which will accept Hosts originating from specific IP addresses only.
What is happening is whenever the request is being made - the server is picking up one of the many IP addresses available in its pool to fetch the request and thus not validating and getting a Host Authorization Failure.
Is their any setting which I can make in Web.config or anything which I could do so that I can bind my dedicated IP to be the outgoing server request IP address !!!
PLEASE HELP !!!
Regards,
Ani
|
|
|
|
|
Please don't cross post.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|