The exception is most likely caused by the fact that FormA does not have a
Menu associated with it, whereas FormB does. It works with your second case
because FormA is hidden and FormB (which probably has a Menu) is shown.
InputPanel.Enabled will only work if you have a mainmenu associated with
the currently visible Form.
The solution would be to place a Menu on your FormA. It can even be empty.
-Armin
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Dolphin White" <(E-Mail Removed)>
| Subject: The bug of InputPane?
| Date: Wed, 3 Sep 2003 09:17:18 +0800
| Lines: 30
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <(E-Mail Removed)>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 218.80.141.183
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:32605
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| I have two forms, one named FormA, another named FormB, and has the code
as
| list:
|
| code in FormA:
|
| FormB dlg = new FormB(this);
| dlg.ShowDialog();
|
| code in FormB:
| _parent.Hide(); //_parent is the parameter passed by constructor
| ......
| _parent.Show();
| _inputPanel.Enabled = false; // <--- Throw an exception, no detail
| information.
|
|
| But if I change the code as below:
| code in FormB:
| _parent.Hide(); //_parent is the parameter passed by constructor
| ......
| _inputPanel.Enabled = false;
| _parent.Show(); //It works fine.
|
| Why the second one works fine, and the first one thrown an unknown
| exception?
|
| Thanks!
|
|
|
|
|