Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to set tab index to data grid view's 1'st column how can it be done?
Posted
Updated 31-Dec-09 0:25am
v3

1 solution

try this :

foreach (DataGridViewColumn column in dataGridView1.Columns)
{
column.SortMode = DataGridViewColumnSortMode.Programmatic;
}
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect;
this.dataGridView1.Columns[1].Selected = true;


Or, instead of the foreach loop, when creating your columns, either by designer or code, set their SortMode to Programmatic, and their selection mode to either ColumnHeaderSelect or FullColumnSelect as you need. after that, doing the last line each time will work fine.

----------------------------
Regards

H.Maadani
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900