天天看点

DataGridView编辑完某个单元格自动根据某列排序

DataGridView编辑完某个单元格自动根据某列排序

/// <summary>
/// 列排序
/// </summary>
private void toolStripButton6_Click(object sender, EventArgs e)
{
    if (dtCopy == null)
    {
        return;
    }

    int selcol = dataGridView1.CurrentCell.ColumnIndex;
    dataGridView1.Sort(dataGridView1.Columns[selcol], ListSortDirection.Ascending);
}      

继续阅读