views:

19

answers:

1

hi. in C# 4.0 (Visual Studio 2010), i have a Windows Form DataGridView that must be multiselect, and it has a specified Column that i don't want its cells to be selectable. what should i do?

A: 

i found that there's no property or style to do that, so we should handle it in someway like this:

private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
            if (dataGridView1.Columns[dataGridView1.CurrentCell.ColumnIndex].Name == mySpecifiedColumn.Name)
                dataGridView1.CurrentCell.Selected = false;
}

thanks.