When I try to catch the Resize event to handle sizing of MDI children, the event is called even before my form’s constructor can create the children throwing an exception. How do I avoid this
The Resize event is getting raised before the constructor completes because the form is being resized in the constructor. If you are using VS.NET to create your project, then in your constructor there is a call to InitializeComponent. In this method there is code to resize the form. You could instantiate your child form in your constructor *before* InitializeComponent is called, then when the form gets resized for the first time you already have an instance of your child form. ([email protected]_(Brian_Roder))
How do I prevent a Form from closing when the user clicks on the close button on the form’s system menu
Handle the form’s Closing event. private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if( NotOkToClose() ) e.Cancel = true; //don’t close }
In my databound ComboBox, how do I set the SelectedItem property
Use the FindStringExact method. For example, if you have set the ComboBox’s ValueMember property to ‘OrderID’, then you could call comboBox1.SelectedIndex = comboBox1.FindStringExact(stringOrderID); where stringOrderID is the ‘orderID’ of the row to be selected.
What is the replacement for VB6’s SendKeys statement
It is the Send method from the SendKeys class found in the System.Windows.Forms namespace.
How do I make a class expandable within the property browser
Add a TypeConverter to your class type to tell the Property Browser it should be expandable. [TypeConverter(typeof(ExpandableObjectConverter))] public class MyClass { } (from [email protected] on microsoft.public.dotnet.framework.windowsforms)