b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

datagridview重叠_datagridview绑定list_datagridview右键菜单(49)

电脑杂谈  发布时间:2017-05-30 08:07:57  来源:网络整理

DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn();

col1.DataPropertyName = "C2";

dataGridView1.Columns.Add(col1);

col1.SortMode = DataGridViewColumnSortMode.Programmatic;

col1.HeaderCell.SortGlyphDirection = SortOrder.Ascending;

DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn();

col2.DataPropertyName = "C3";

dataGridView1.Columns.Add(col2);

col2.SortMode = DataGridViewColumnSortMode.Programmatic;

col2.HeaderCell.SortGlyphDirection = SortOrder.Ascending;

9.2 Unbound DataGridView

To provide support for sorting on multiple columns you can handle the SortCompare event or call the Sort(IComparer) overload of the Sort method for greater sorting flexibility.

9.2.1 Custom Sorting Using the SortCompare Event

The following code example demonstrates custom sorting using a SortCompare event handler. The selected DataGridViewColumn is sorted and, if there are duplicate values in the column, the ID column is used to determine the final order.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Windows.Forms;

class Form1 : Form

{

private DataGridView dataGridView1 = new DataGridView();

// Establish the main entry point for the application.

[STAThreadAttribute()]

static void Main()

{

Application.EnableVisualStyles();

Application.Run(new Form1());

}

public Form1()

{

// Initialize the form.

// This code can be replaced with designer generated code.

dataGridView1.AllowUserToAddRows = false;


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-50070-49.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...