Click here to Skip to main content
15,881,600 members
Articles / Programming Languages / C#

Generic Multi-Field/Property Sorting for Lists of Business Objects

Rate me:
Please Sign up or sign in to vote.
4.89/5 (13 votes)
13 Feb 2008CPOL8 min read 75.1K   495   72  
This article presents a simple and flexible way to sort strongly-typed lists of business objects using multiple properties or fields.
namespace MultiSortDemo
{
  partial class FormMultiSortDemo
  {
    /// <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.components = new System.ComponentModel.Container();
        System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
        this.dgvList = new System.Windows.Forms.DataGridView();
        this.priorityDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.assignedToDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.dateAssignedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.assignedByDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.taskBoredomDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.dateFinishedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.workItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
        this.lblResults = new System.Windows.Forms.Label();
        this.rbProperties = new System.Windows.Forms.RadioButton();
        this.rbFields = new System.Windows.Forms.RadioButton();
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.panel1 = new System.Windows.Forms.Panel();
        this.cb1 = new System.Windows.Forms.ComboBox();
        this.workItemPropertyNameBindingSource1 = new System.Windows.Forms.BindingSource(this.components);
        this.workItemPropertyNameBindingSource2 = new System.Windows.Forms.BindingSource(this.components);
        this.workItemPropertyNameBindingSource3 = new System.Windows.Forms.BindingSource(this.components);
        this.workItemPropertyNameBindingSource4 = new System.Windows.Forms.BindingSource(this.components);
        this.workItemPropertyNameBindingSource5 = new System.Windows.Forms.BindingSource(this.components);
        this.chk1 = new System.Windows.Forms.CheckBox();
        this.chk2 = new System.Windows.Forms.CheckBox();
        this.cb2 = new System.Windows.Forms.ComboBox();
        this.chk3 = new System.Windows.Forms.CheckBox();
        this.cb3 = new System.Windows.Forms.ComboBox();
        this.chk4 = new System.Windows.Forms.CheckBox();
        this.cb4 = new System.Windows.Forms.ComboBox();
        this.chk5 = new System.Windows.Forms.CheckBox();
        this.cb5 = new System.Windows.Forms.ComboBox();
        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.label5 = new System.Windows.Forms.Label();
        this.btnSort = new System.Windows.Forms.Button();
        this.panel2 = new System.Windows.Forms.Panel();
        this.panel3 = new System.Windows.Forms.Panel();
        this.label6 = new System.Windows.Forms.Label();
        this.txtItemCount = new System.Windows.Forms.TextBox();
        this.btnGenerateItems = new System.Windows.Forms.Button();
        this.chkHideGrid = new System.Windows.Forms.CheckBox();
        this.panel4 = new System.Windows.Forms.Panel();
        ((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemBindingSource)).BeginInit();
        this.groupBox1.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource1)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource2)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource3)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource4)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource5)).BeginInit();
        this.SuspendLayout();
        // 
        // dgvList
        // 
        this.dgvList.AllowUserToAddRows = false;
        this.dgvList.AllowUserToDeleteRows = false;
        this.dgvList.AllowUserToResizeRows = false;
        this.dgvList.AutoGenerateColumns = false;
        dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
        dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
        dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
        dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
        dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
        dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
        this.dgvList.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
        this.dgvList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
        this.dgvList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.priorityDataGridViewTextBoxColumn,
            this.assignedToDataGridViewTextBoxColumn,
            this.dateAssignedDataGridViewTextBoxColumn,
            this.assignedByDataGridViewTextBoxColumn,
            this.taskBoredomDataGridViewTextBoxColumn,
            this.dateFinishedDataGridViewTextBoxColumn});
        this.dgvList.DataSource = this.workItemBindingSource;
        this.dgvList.Dock = System.Windows.Forms.DockStyle.Left;
        this.dgvList.Location = new System.Drawing.Point(0, 0);
        this.dgvList.Margin = new System.Windows.Forms.Padding(2);
        this.dgvList.MultiSelect = false;
        this.dgvList.Name = "dgvList";
        this.dgvList.ReadOnly = true;
        this.dgvList.RowHeadersVisible = false;
        this.dgvList.RowHeadersWidth = 12;
        this.dgvList.RowTemplate.Height = 24;
        this.dgvList.ShowCellErrors = false;
        this.dgvList.ShowCellToolTips = false;
        this.dgvList.ShowEditingIcon = false;
        this.dgvList.ShowRowErrors = false;
        this.dgvList.Size = new System.Drawing.Size(528, 573);
        this.dgvList.TabIndex = 0;
        this.dgvList.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvList_ColumnHeaderMouseClick);
        // 
        // priorityDataGridViewTextBoxColumn
        // 
        this.priorityDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
        this.priorityDataGridViewTextBoxColumn.DataPropertyName = "Priority";
        this.priorityDataGridViewTextBoxColumn.HeaderText = "Pri";
        this.priorityDataGridViewTextBoxColumn.Name = "priorityDataGridViewTextBoxColumn";
        this.priorityDataGridViewTextBoxColumn.ReadOnly = true;
        this.priorityDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
        this.priorityDataGridViewTextBoxColumn.Width = 44;
        // 
        // assignedToDataGridViewTextBoxColumn
        // 
        this.assignedToDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
        this.assignedToDataGridViewTextBoxColumn.DataPropertyName = "AssignedTo";
        this.assignedToDataGridViewTextBoxColumn.HeaderText = "Assigned To";
        this.assignedToDataGridViewTextBoxColumn.Name = "assignedToDataGridViewTextBoxColumn";
        this.assignedToDataGridViewTextBoxColumn.ReadOnly = true;
        this.assignedToDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
        this.assignedToDataGridViewTextBoxColumn.Width = 91;
        // 
        // dateAssignedDataGridViewTextBoxColumn
        // 
        this.dateAssignedDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
        this.dateAssignedDataGridViewTextBoxColumn.DataPropertyName = "DateAssigned";
        this.dateAssignedDataGridViewTextBoxColumn.HeaderText = "Assigned";
        this.dateAssignedDataGridViewTextBoxColumn.Name = "dateAssignedDataGridViewTextBoxColumn";
        this.dateAssignedDataGridViewTextBoxColumn.ReadOnly = true;
        this.dateAssignedDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
        this.dateAssignedDataGridViewTextBoxColumn.Width = 75;
        // 
        // assignedByDataGridViewTextBoxColumn
        // 
        this.assignedByDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
        this.assignedByDataGridViewTextBoxColumn.DataPropertyName = "AssignedBy";
        this.assignedByDataGridViewTextBoxColumn.HeaderText = "Assigned By";
        this.assignedByDataGridViewTextBoxColumn.Name = "assignedByDataGridViewTextBoxColumn";
        this.assignedByDataGridViewTextBoxColumn.ReadOnly = true;
        this.assignedByDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
        this.assignedByDataGridViewTextBoxColumn.Width = 90;
        // 
        // taskBoredomDataGridViewTextBoxColumn
        // 
        this.taskBoredomDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
        this.taskBoredomDataGridViewTextBoxColumn.DataPropertyName = "TaskBoredom";
        this.taskBoredomDataGridViewTextBoxColumn.HeaderText = "Task Boredom (Enum)";
        this.taskBoredomDataGridViewTextBoxColumn.Name = "taskBoredomDataGridViewTextBoxColumn";
        this.taskBoredomDataGridViewTextBoxColumn.ReadOnly = true;
        this.taskBoredomDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
        this.taskBoredomDataGridViewTextBoxColumn.Width = 137;
        // 
        // dateFinishedDataGridViewTextBoxColumn
        // 
        this.dateFinishedDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
        this.dateFinishedDataGridViewTextBoxColumn.DataPropertyName = "DateFinished";
        this.dateFinishedDataGridViewTextBoxColumn.HeaderText = "Completed";
        this.dateFinishedDataGridViewTextBoxColumn.Name = "dateFinishedDataGridViewTextBoxColumn";
        this.dateFinishedDataGridViewTextBoxColumn.ReadOnly = true;
        this.dateFinishedDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
        this.dateFinishedDataGridViewTextBoxColumn.Width = 82;
        // 
        // workItemBindingSource
        // 
        this.workItemBindingSource.DataSource = typeof(MultiSortDemo.WorkItem);
        // 
        // lblResults
        // 
        this.lblResults.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.lblResults.Location = new System.Drawing.Point(532, 400);
        this.lblResults.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
        this.lblResults.Name = "lblResults";
        this.lblResults.Size = new System.Drawing.Size(233, 106);
        this.lblResults.TabIndex = 3;
        this.lblResults.Text = "Timing/Speed results appear here";
        this.lblResults.TextAlign = System.Drawing.ContentAlignment.TopCenter;
        // 
        // rbProperties
        // 
        this.rbProperties.AutoSize = true;
        this.rbProperties.Checked = true;
        this.rbProperties.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.rbProperties.Location = new System.Drawing.Point(11, 17);
        this.rbProperties.Margin = new System.Windows.Forms.Padding(2);
        this.rbProperties.Name = "rbProperties";
        this.rbProperties.Size = new System.Drawing.Size(222, 21);
        this.rbProperties.TabIndex = 6;
        this.rbProperties.TabStop = true;
        this.rbProperties.Text = "Use Property values for sorting";
        this.rbProperties.UseVisualStyleBackColor = true;
        // 
        // rbFields
        // 
        this.rbFields.AutoSize = true;
        this.rbFields.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.rbFields.Location = new System.Drawing.Point(11, 39);
        this.rbFields.Margin = new System.Windows.Forms.Padding(2);
        this.rbFields.Name = "rbFields";
        this.rbFields.Size = new System.Drawing.Size(198, 21);
        this.rbFields.TabIndex = 7;
        this.rbFields.Text = "Use Field values for sorting";
        this.rbFields.UseVisualStyleBackColor = true;
        // 
        // groupBox1
        // 
        this.groupBox1.Controls.Add(this.rbProperties);
        this.groupBox1.Controls.Add(this.rbFields);
        this.groupBox1.Location = new System.Drawing.Point(534, 10);
        this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
        this.groupBox1.Size = new System.Drawing.Size(234, 63);
        this.groupBox1.TabIndex = 8;
        this.groupBox1.TabStop = false;
        this.groupBox1.Text = "Value Retrieval";
        // 
        // panel1
        // 
        this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
        this.panel1.Location = new System.Drawing.Point(534, 75);
        this.panel1.Margin = new System.Windows.Forms.Padding(0);
        this.panel1.Name = "panel1";
        this.panel1.Size = new System.Drawing.Size(234, 5);
        this.panel1.TabIndex = 9;
        // 
        // cb1
        // 
        this.cb1.DataSource = this.workItemPropertyNameBindingSource1;
        this.cb1.DisplayMember = "PropertyName";
        this.cb1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.cb1.FormattingEnabled = true;
        this.cb1.Location = new System.Drawing.Point(612, 87);
        this.cb1.Margin = new System.Windows.Forms.Padding(2);
        this.cb1.MaxDropDownItems = 10;
        this.cb1.Name = "cb1";
        this.cb1.Size = new System.Drawing.Size(153, 21);
        this.cb1.TabIndex = 10;
        this.cb1.ValueMember = "PropertyName";
        // 
        // workItemPropertyNameBindingSource1
        // 
        this.workItemPropertyNameBindingSource1.DataSource = typeof(MultiSortDemo.WorkItemPropertyName);
        // 
        // workItemPropertyNameBindingSource2
        // 
        this.workItemPropertyNameBindingSource2.DataSource = typeof(MultiSortDemo.WorkItemPropertyName);
        // 
        // workItemPropertyNameBindingSource3
        // 
        this.workItemPropertyNameBindingSource3.DataSource = typeof(MultiSortDemo.WorkItemPropertyName);
        // 
        // workItemPropertyNameBindingSource4
        // 
        this.workItemPropertyNameBindingSource4.DataSource = typeof(MultiSortDemo.WorkItemPropertyName);
        // 
        // workItemPropertyNameBindingSource5
        // 
        this.workItemPropertyNameBindingSource5.DataSource = typeof(MultiSortDemo.WorkItemPropertyName);
        // 
        // chk1
        // 
        this.chk1.AutoSize = true;
        this.chk1.Location = new System.Drawing.Point(612, 112);
        this.chk1.Margin = new System.Windows.Forms.Padding(2);
        this.chk1.Name = "chk1";
        this.chk1.Size = new System.Drawing.Size(105, 17);
        this.chk1.TabIndex = 11;
        this.chk1.Text = "Sort Descending";
        this.chk1.UseVisualStyleBackColor = true;
        // 
        // chk2
        // 
        this.chk2.AutoSize = true;
        this.chk2.Location = new System.Drawing.Point(612, 161);
        this.chk2.Margin = new System.Windows.Forms.Padding(2);
        this.chk2.Name = "chk2";
        this.chk2.Size = new System.Drawing.Size(105, 17);
        this.chk2.TabIndex = 13;
        this.chk2.Text = "Sort Descending";
        this.chk2.UseVisualStyleBackColor = true;
        // 
        // cb2
        // 
        this.cb2.DataSource = this.workItemPropertyNameBindingSource2;
        this.cb2.DisplayMember = "PropertyName";
        this.cb2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.cb2.FormattingEnabled = true;
        this.cb2.Location = new System.Drawing.Point(613, 136);
        this.cb2.Margin = new System.Windows.Forms.Padding(2);
        this.cb2.MaxDropDownItems = 10;
        this.cb2.Name = "cb2";
        this.cb2.Size = new System.Drawing.Size(153, 21);
        this.cb2.TabIndex = 12;
        this.cb2.ValueMember = "PropertyName";
        // 
        // chk3
        // 
        this.chk3.AutoSize = true;
        this.chk3.Location = new System.Drawing.Point(612, 214);
        this.chk3.Margin = new System.Windows.Forms.Padding(2);
        this.chk3.Name = "chk3";
        this.chk3.Size = new System.Drawing.Size(105, 17);
        this.chk3.TabIndex = 15;
        this.chk3.Text = "Sort Descending";
        this.chk3.UseVisualStyleBackColor = true;
        // 
        // cb3
        // 
        this.cb3.DataSource = this.workItemPropertyNameBindingSource3;
        this.cb3.DisplayMember = "PropertyName";
        this.cb3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.cb3.FormattingEnabled = true;
        this.cb3.Location = new System.Drawing.Point(613, 189);
        this.cb3.Margin = new System.Windows.Forms.Padding(2);
        this.cb3.MaxDropDownItems = 10;
        this.cb3.Name = "cb3";
        this.cb3.Size = new System.Drawing.Size(153, 21);
        this.cb3.TabIndex = 14;
        this.cb3.ValueMember = "PropertyName";
        // 
        // chk4
        // 
        this.chk4.AutoSize = true;
        this.chk4.Location = new System.Drawing.Point(612, 271);
        this.chk4.Margin = new System.Windows.Forms.Padding(2);
        this.chk4.Name = "chk4";
        this.chk4.Size = new System.Drawing.Size(105, 17);
        this.chk4.TabIndex = 17;
        this.chk4.Text = "Sort Descending";
        this.chk4.UseVisualStyleBackColor = true;
        // 
        // cb4
        // 
        this.cb4.DataSource = this.workItemPropertyNameBindingSource4;
        this.cb4.DisplayMember = "PropertyName";
        this.cb4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.cb4.FormattingEnabled = true;
        this.cb4.Location = new System.Drawing.Point(613, 246);
        this.cb4.Margin = new System.Windows.Forms.Padding(2);
        this.cb4.MaxDropDownItems = 10;
        this.cb4.Name = "cb4";
        this.cb4.Size = new System.Drawing.Size(153, 21);
        this.cb4.TabIndex = 16;
        this.cb4.ValueMember = "PropertyName";
        // 
        // chk5
        // 
        this.chk5.AutoSize = true;
        this.chk5.Location = new System.Drawing.Point(612, 326);
        this.chk5.Margin = new System.Windows.Forms.Padding(2);
        this.chk5.Name = "chk5";
        this.chk5.Size = new System.Drawing.Size(105, 17);
        this.chk5.TabIndex = 19;
        this.chk5.Text = "Sort Descending";
        this.chk5.UseVisualStyleBackColor = true;
        // 
        // cb5
        // 
        this.cb5.DataSource = this.workItemPropertyNameBindingSource5;
        this.cb5.DisplayMember = "PropertyName";
        this.cb5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.cb5.FormattingEnabled = true;
        this.cb5.Location = new System.Drawing.Point(613, 301);
        this.cb5.Margin = new System.Windows.Forms.Padding(2);
        this.cb5.MaxDropDownItems = 10;
        this.cb5.Name = "cb5";
        this.cb5.Size = new System.Drawing.Size(153, 21);
        this.cb5.TabIndex = 18;
        this.cb5.ValueMember = "PropertyName";
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.Location = new System.Drawing.Point(532, 90);
        this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(42, 13);
        this.label1.TabIndex = 20;
        this.label1.Text = "Sort #1";
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.Location = new System.Drawing.Point(532, 139);
        this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(42, 13);
        this.label2.TabIndex = 21;
        this.label2.Text = "Sort #2";
        // 
        // label3
        // 
        this.label3.AutoSize = true;
        this.label3.Location = new System.Drawing.Point(532, 192);
        this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
        this.label3.Name = "label3";
        this.label3.Size = new System.Drawing.Size(42, 13);
        this.label3.TabIndex = 22;
        this.label3.Text = "Sort #3";
        // 
        // label4
        // 
        this.label4.AutoSize = true;
        this.label4.Location = new System.Drawing.Point(532, 249);
        this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
        this.label4.Name = "label4";
        this.label4.Size = new System.Drawing.Size(42, 13);
        this.label4.TabIndex = 23;
        this.label4.Text = "Sort #4";
        // 
        // label5
        // 
        this.label5.AutoSize = true;
        this.label5.Location = new System.Drawing.Point(532, 301);
        this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
        this.label5.Name = "label5";
        this.label5.Size = new System.Drawing.Size(42, 13);
        this.label5.TabIndex = 24;
        this.label5.Text = "Sort #5";
        // 
        // btnSort
        // 
        this.btnSort.Location = new System.Drawing.Point(534, 347);
        this.btnSort.Margin = new System.Windows.Forms.Padding(2);
        this.btnSort.Name = "btnSort";
        this.btnSort.Size = new System.Drawing.Size(233, 37);
        this.btnSort.TabIndex = 25;
        this.btnSort.Text = "Sort using the above criteria";
        this.btnSort.UseVisualStyleBackColor = true;
        this.btnSort.Click += new System.EventHandler(this.btnSort_Click);
        // 
        // panel2
        // 
        this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
        this.panel2.Location = new System.Drawing.Point(535, 544);
        this.panel2.Margin = new System.Windows.Forms.Padding(0);
        this.panel2.Name = "panel2";
        this.panel2.Size = new System.Drawing.Size(234, 5);
        this.panel2.TabIndex = 26;
        // 
        // panel3
        // 
        this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
        this.panel3.Location = new System.Drawing.Point(532, 386);
        this.panel3.Margin = new System.Windows.Forms.Padding(0);
        this.panel3.Name = "panel3";
        this.panel3.Size = new System.Drawing.Size(235, 5);
        this.panel3.TabIndex = 27;
        // 
        // label6
        // 
        this.label6.AutoSize = true;
        this.label6.Location = new System.Drawing.Point(535, 516);
        this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
        this.label6.Name = "label6";
        this.label6.Size = new System.Drawing.Size(62, 13);
        this.label6.TabIndex = 28;
        this.label6.Text = "Total Items:";
        // 
        // txtItemCount
        // 
        this.txtItemCount.Location = new System.Drawing.Point(601, 513);
        this.txtItemCount.Margin = new System.Windows.Forms.Padding(2);
        this.txtItemCount.Name = "txtItemCount";
        this.txtItemCount.Size = new System.Drawing.Size(74, 20);
        this.txtItemCount.TabIndex = 29;
        // 
        // btnGenerateItems
        // 
        this.btnGenerateItems.Location = new System.Drawing.Point(679, 512);
        this.btnGenerateItems.Margin = new System.Windows.Forms.Padding(2);
        this.btnGenerateItems.Name = "btnGenerateItems";
        this.btnGenerateItems.Size = new System.Drawing.Size(86, 20);
        this.btnGenerateItems.TabIndex = 30;
        this.btnGenerateItems.Text = "Generate";
        this.btnGenerateItems.UseVisualStyleBackColor = true;
        this.btnGenerateItems.Click += new System.EventHandler(this.btnGenerateItems_Click);
        // 
        // chkHideGrid
        // 
        this.chkHideGrid.AutoSize = true;
        this.chkHideGrid.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.chkHideGrid.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
        this.chkHideGrid.Location = new System.Drawing.Point(534, 554);
        this.chkHideGrid.Margin = new System.Windows.Forms.Padding(2);
        this.chkHideGrid.Name = "chkHideGrid";
        this.chkHideGrid.Size = new System.Drawing.Size(230, 19);
        this.chkHideGrid.TabIndex = 31;
        this.chkHideGrid.Text = "Suspend grid updates/refreshes";
        this.chkHideGrid.UseVisualStyleBackColor = true;
        this.chkHideGrid.CheckedChanged += new System.EventHandler(this.chkHideGrid_CheckedChanged);
        // 
        // panel4
        // 
        this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
        this.panel4.Location = new System.Drawing.Point(534, 506);
        this.panel4.Margin = new System.Windows.Forms.Padding(0);
        this.panel4.Name = "panel4";
        this.panel4.Size = new System.Drawing.Size(234, 5);
        this.panel4.TabIndex = 32;
        // 
        // FormMultiSortDemo
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(776, 573);
        this.Controls.Add(this.panel4);
        this.Controls.Add(this.chkHideGrid);
        this.Controls.Add(this.btnGenerateItems);
        this.Controls.Add(this.txtItemCount);
        this.Controls.Add(this.label6);
        this.Controls.Add(this.panel3);
        this.Controls.Add(this.panel2);
        this.Controls.Add(this.btnSort);
        this.Controls.Add(this.label5);
        this.Controls.Add(this.label4);
        this.Controls.Add(this.label3);
        this.Controls.Add(this.label2);
        this.Controls.Add(this.label1);
        this.Controls.Add(this.chk5);
        this.Controls.Add(this.cb5);
        this.Controls.Add(this.chk4);
        this.Controls.Add(this.cb4);
        this.Controls.Add(this.chk3);
        this.Controls.Add(this.cb3);
        this.Controls.Add(this.chk2);
        this.Controls.Add(this.cb2);
        this.Controls.Add(this.chk1);
        this.Controls.Add(this.cb1);
        this.Controls.Add(this.panel1);
        this.Controls.Add(this.groupBox1);
        this.Controls.Add(this.lblResults);
        this.Controls.Add(this.dgvList);
        this.Margin = new System.Windows.Forms.Padding(2);
        this.Name = "FormMultiSortDemo";
        this.Text = "Multi Sort Demo";
        this.Load += new System.EventHandler(this.FormMultiSortDemo_Load);
        ((System.ComponentModel.ISupportInitialize)(this.dgvList)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemBindingSource)).EndInit();
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource1)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource2)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource3)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource4)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.workItemPropertyNameBindingSource5)).EndInit();
        this.ResumeLayout(false);
        this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.DataGridView dgvList;
      private System.Windows.Forms.BindingSource workItemBindingSource;
    private System.Windows.Forms.Label lblResults;
    private System.Windows.Forms.RadioButton rbProperties;
    private System.Windows.Forms.RadioButton rbFields;
    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.Panel panel1;
    private System.Windows.Forms.ComboBox cb1;
    private System.Windows.Forms.CheckBox chk1;
    private System.Windows.Forms.BindingSource workItemPropertyNameBindingSource1;
    private System.Windows.Forms.BindingSource workItemPropertyNameBindingSource2;
    private System.Windows.Forms.BindingSource workItemPropertyNameBindingSource3;
    private System.Windows.Forms.BindingSource workItemPropertyNameBindingSource4;
    private System.Windows.Forms.BindingSource workItemPropertyNameBindingSource5;
    private System.Windows.Forms.CheckBox chk2;
    private System.Windows.Forms.ComboBox cb2;
    private System.Windows.Forms.CheckBox chk3;
    private System.Windows.Forms.ComboBox cb3;
    private System.Windows.Forms.CheckBox chk4;
    private System.Windows.Forms.ComboBox cb4;
    private System.Windows.Forms.CheckBox chk5;
    private System.Windows.Forms.ComboBox cb5;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.Label label5;
    private System.Windows.Forms.Button btnSort;
    private System.Windows.Forms.Panel panel2;
    private System.Windows.Forms.Panel panel3;
    private System.Windows.Forms.Label label6;
    private System.Windows.Forms.TextBox txtItemCount;
    private System.Windows.Forms.Button btnGenerateItems;
    private System.Windows.Forms.CheckBox chkHideGrid;
      private System.Windows.Forms.Panel panel4;
      private System.Windows.Forms.DataGridViewTextBoxColumn priorityDataGridViewTextBoxColumn;
      private System.Windows.Forms.DataGridViewTextBoxColumn assignedToDataGridViewTextBoxColumn;
      private System.Windows.Forms.DataGridViewTextBoxColumn dateAssignedDataGridViewTextBoxColumn;
      private System.Windows.Forms.DataGridViewTextBoxColumn assignedByDataGridViewTextBoxColumn;
      private System.Windows.Forms.DataGridViewTextBoxColumn taskBoredomDataGridViewTextBoxColumn;
      private System.Windows.Forms.DataGridViewTextBoxColumn dateFinishedDataGridViewTextBoxColumn;
  }
}

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 Code Project Open License (CPOL)


Written By
Software Developer (Senior) Troppus Software
United States United States
Currently working as a Senior Silverlight Developer with Troppus Software in Superior, CO. I enjoy statistics, programming, new technology, playing the cello, and reading codeproject articles. Smile | :)

Comments and Discussions