Click here to Skip to main content
12,622,291 members (33,833 online)
Click here to Skip to main content

Stats

209.6K views
8.6K downloads
146 bookmarked
Posted

A data-bound multi-column combobox

, 27 Jul 2007 BSD
An ownerdrawn multi-column combobox class with support for data-binding
namespace MultiColumnComboBoxDemo
{
    partial class DemoForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.multiColumnComboBox4 = new MultiColumnComboBoxDemo.MultiColumnComboBox();
            this.multiColumnComboBox3 = new MultiColumnComboBoxDemo.MultiColumnComboBox();
            this.multiColumnComboBox2 = new MultiColumnComboBoxDemo.MultiColumnComboBox();
            this.multiColumnComboBox1 = new MultiColumnComboBoxDemo.MultiColumnComboBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // multiColumnComboBox4
            // 
            this.multiColumnComboBox4.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
            this.multiColumnComboBox4.FormattingEnabled = true;
            this.multiColumnComboBox4.Location = new System.Drawing.Point(29, 178);
            this.multiColumnComboBox4.Name = "multiColumnComboBox4";
            this.multiColumnComboBox4.Size = new System.Drawing.Size(121, 21);
            this.multiColumnComboBox4.TabIndex = 0;
            // 
            // multiColumnComboBox3
            // 
            this.multiColumnComboBox3.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
            this.multiColumnComboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.multiColumnComboBox3.FormattingEnabled = true;
            this.multiColumnComboBox3.Location = new System.Drawing.Point(29, 120);
            this.multiColumnComboBox3.Name = "multiColumnComboBox3";
            this.multiColumnComboBox3.Size = new System.Drawing.Size(121, 21);
            this.multiColumnComboBox3.TabIndex = 0;
            // 
            // multiColumnComboBox2
            // 
            this.multiColumnComboBox2.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
            this.multiColumnComboBox2.FormattingEnabled = true;
            this.multiColumnComboBox2.Location = new System.Drawing.Point(29, 66);
            this.multiColumnComboBox2.Name = "multiColumnComboBox2";
            this.multiColumnComboBox2.Size = new System.Drawing.Size(121, 21);
            this.multiColumnComboBox2.TabIndex = 0;
            // 
            // multiColumnComboBox1
            // 
            this.multiColumnComboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
            this.multiColumnComboBox1.FormattingEnabled = true;
            this.multiColumnComboBox1.Location = new System.Drawing.Point(29, 17);
            this.multiColumnComboBox1.Name = "multiColumnComboBox1";
            this.multiColumnComboBox1.Size = new System.Drawing.Size(121, 21);
            this.multiColumnComboBox1.TabIndex = 0;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(203, 24);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(103, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Bound to DataTable";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(203, 69);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(77, 13);
            this.label2.TabIndex = 1;
            this.label2.Text = "Bound to Array";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(203, 123);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(143, 13);
            this.label3.TabIndex = 1;
            this.label3.Text = "Bound to List (drop-down list)";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(203, 178);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(83, 13);
            this.label4.TabIndex = 1;
            this.label4.Text = "Unbound usage";
            // 
            // DemoForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(379, 335);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.multiColumnComboBox4);
            this.Controls.Add(this.multiColumnComboBox3);
            this.Controls.Add(this.multiColumnComboBox2);
            this.Controls.Add(this.multiColumnComboBox1);
            this.Name = "DemoForm";
            this.Text = "MultiColumnComboBox Demo";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private MultiColumnComboBox multiColumnComboBox1;
        private MultiColumnComboBox multiColumnComboBox2;
        private MultiColumnComboBox multiColumnComboBox3;
        private MultiColumnComboBox multiColumnComboBox4;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License

Share

About the Author

Nish Nishant
United States United States
Nish Nishant is a Software Architect/Consultant based out of Columbus, Ohio. He has over 16 years of software industry experience in various roles including Lead Software Architect, Principal Software Engineer, and Product Manager. Nish is a recipient of the annual Microsoft Visual C++ MVP Award since 2002 (14 consecutive awards as of 2015).

Nish is an industry acknowledged expert in the Microsoft technology stack. He authored
C++/CLI in Action for Manning Publications in 2005, and had previously co-authored
Extending MFC Applications with the .NET Framework for Addison Wesley in 2003. In addition, he has over 140 published technology articles on CodeProject.com and another 250+ blog articles on his
WordPress blog. Nish is vastly experienced in team management, mentoring teams, and directing all stages of software development.

Contact Nish : You can reach Nish on his google email id voidnish.

Website and Blog

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161128.1 | Last Updated 27 Jul 2007
Article Copyright 2007 by Nish Nishant
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid