How do I return values from a form
Add public properties to your form. Then these properties can be accessed by any object that creates an instance of your form.
When I try to set a particular font style, say italics, I get an error message ‘Property cannot be assigned to — it is read only’. How can I set this read only property
Code such as tabControl1.Font.Italic = true; will not work. Instead, you have to create a new Font object, and set the property during its creation. This code will work. tabControl1.Font = new Font(tabControl1.Font, FontStyle.Italic);
For a TabControl, how do I make the tabs on the tab pages appear on the bottom instead of on the right
Set the TabControl.Alignment property to TabAlignment.Bottom. tabControl1.Alignment = TabAlignment.Bottom; You can also change the tabs into buttons using the Appearance property and TabAppearance enums.
When I call ListViewItem.Selected = true;, why doesn’t the item get selected
Make sure the ListView has focus when you set the Selected property. For example, if this code is in the click handler for a button, this button will have the focus, and the selection in the list will fail. Just set the focus back to the list before you set the Selected property.
How can I convert the string ‘Red’ into the color Color.Red, and vice versa
You can use the TypeDescriptor class to handle this. Color redColor = (Color)TypeDescriptor.GetConverter(typeof(Color)).ConvertFromString(‘Red’); string redString = TypeDescriptor.GetConverter(typeof(Color)).ConvertToString(Color.Red); You can also use code such as System.Drawing.ColorConverter ccv = new System.Drawing.ColorConverter(); this.BackColor = (Color) ccv.ConvertFromString(‘Red’);