#region Using directives using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; #endregion namespace StandardListControlsSample { partial class MainForm : Form { public MainForm() { InitializeComponent(); // LISTBOX this.listBox1.SelectionMode = SelectionMode.MultiExtended; // TREEVIEW // Associate with ImageList this.treeView.ImageList = this.treeViewImageList; this.treeView.ImageIndex = 0; this.treeView.SelectedImageIndex = 1; // Create top tree node TreeNode topNode = this.treeView.Nodes.Add("Top Node"); // Add child nodes in the top node topNode.Nodes.Add("Child Node"); topNode.Nodes.Add("Another Child Node"); // LISTVIEW // Show ListView in Details mode this.listView.View = View.Details; // Create column this.listView.Columns.Add("First Column"); // Associate with ImageList this.listView.LargeImageList = this.listViewImageList; // Add new list view items to ListView this.listView.Items.AddRange( new System.Windows.Forms.ListViewItem[] { new ListViewItem("First Item", 0), new ListViewItem("Second Item", 1), new ListViewItem("Third Item", 2), new ListViewItem("Fourth Item", 3), new ListViewItem("Fifth Item", 4) } ); } private void StandardListControlsSampleForm_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'northwindDataSet.Employees' table. You can move, or remove it, as needed. this.employeesTableAdapter.Fill(this.northwindDataSet.Employees); } private void bindingNavigatorSaveItem_Click(object sender, EventArgs e) { if( this.Validate() ) { this.employeesBindingSource.EndEdit(); this.employeesTableAdapter.Update(this.northwindDataSet.Employees); } else { System.Windows.Forms.MessageBox.Show(this, "Validation errors occurred.", "Save", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); } } private void checkedListBox_ItemCheck(object sender, ItemCheckEventArgs e) { MessageBox.Show("Item checked: " + e.CurrentValue.ToString()); } } }