How do I bind the values of an enum to a ComboBox?
This entry was created using the feedback provided by Jay Harlow in the newsgroups. The enum values can be bound to a combobox as follows: [C#] // Setup the binding as follows: // MyValues is the enum type comboBox1.DataSource = Enum.GetValues(typeof MyValues); [VB] comboBox1.DataSource = Enum.GetValues(Type.GetType(MyValues)) Then in the SelectedValueChanged event for the ComboBox. [C#] private void ComboBox1ValueChanged(object sender, EventArgs e) { MyValues v = (MyValues)this.comboBox1.SelectedValue; } [VB] Private Sub ComboBox1ValueChanged(ByVal sender As Object, ByVal e As EventArgs) Dim v As MyValues = CType(Me.comboBox1.SelectedValue, MyValues) End Sub
How do I unselect the selected items in a ListView programatically?
Simply do the following: this.listView1.SelectedItems.Clear(); [C#] [VB] Me.listView1.SelectedItems.Clear()
How can I adjust the height of the of my ComboBox dropdown
You can control the height by changing the value of the MaxDropDownItems property of the the Combobox, which is the setting for maximum number of entries that will be displayed by the drop-down list.
How do I prevent users from resizing a form?
You can prevent the users from resizing a form by setting the FormBorderStyle to FixedDialog and setting the MaximizeBox property to false.
How can I center my form?
You can set the Form’s StartPosition property to CenterScreen to achieve this.