Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I have a question. I have a MDI Windows Forms application. I am using VS2008 Express SP1 with .NET 3.5 SP1 and Windows Forms 2.0.

I am really puzzled and not even sure if this is even possible. on the parent window, i have docked a ToolStrip to the top, below the menu bar.

Now, I know you can merge two ToolStrips (just like menus) with a call to ToolStripManager.Merge(). My problem is, I have a ToolStripComboBox on the parent window's ToolStrip and I have it disabled when no MDI windows are open. Instead of have to write hairy UI update code, because I have multiple types of child forms (for multiple document types) and I only want the combo box to be enabled for when a certain type of child window is open.

So my thought was to, using Edit->Copy in the VS2008 form designer, copy and paste the combo box so it's now on a ToolStrip on the child form as well as the main window, and this time though, the child form's ToolStripComboBox is enabled. The DropDownStyle of the ToolStripComboBox is DropDownList, so unfortunately, I cannot set the Text property, which would be the way I can match items with MergeAction.Replace and thus replace the disabled ToolStripComboBox with the child window's enabled ToolStripComboBox when the child window is open and then put the disabled box back when I close all child windows of that type.

But I've tried using MergeAction.Replace on both ToolStripComboBox's with no avail. I'm stuck. Does anyone have any ideas or suggestions?
Posted

1 solution

SPC Brian C. Hart, Ph.D. wrote:
I have a ToolStripComboBox on the parent window's ToolStrip and I have it disabled when no MDI windows are open. Instead of have to write hairy UI update code, because I have multiple types of child forms (for multiple document types) and I only want the combo box to be enabled for when a certain type of child window is open.


That certainly seems to indicate that the proper place for the combo-box is the child window. Is there a reason that's not possible?

Usually when I run into stuff that gets too convoluted and complex, it means it's time to rethink the overall strategy. I'm not sure if there are other considerations in your case, though.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900