Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
How do i move the check box to column 1

VB
DataGridView1.ColumnCount = 15
DataGridView1.Columns(0).Name = "Name"
Me.DataGridView1.Columns(0).DefaultCellStyle _
.Alignment = DataGridViewContentAlignment.MiddleLeft

DataGridView1.Columns(1).Name = "Att. (Y/N)"
DataGridView1.Columns(1).Width = 40
Me.DataGridView1.Columns(1).DefaultCellStyle _
.Alignment = DataGridViewContentAlignment.MiddleCenter

Dim checkCol As DataGridViewCheckBoxColumn = New DataGridViewCheckBoxColumn(1)
checkCol.HeaderText = "No Records"
DataGridView1.Columns.Add(checkCol)

DataGridView1.Columns(2).Name = "Mid. Wk. Call (Y/N)"
DataGridView1.Columns(2).Width = 40
Me.DataGridView1.Columns(2).DefaultCellStyle _
.Alignment = DataGridViewContentAlignment.MiddleCenter
Posted
Updated 16-Aug-13 8:18am
v2
Comments
TryAndSucceed 16-Aug-13 12:24pm    
I think you are defining the column position in the wrong place. You need to do that while adding it to the DataGridView.
PythonProgrammer 16-Aug-13 12:27pm    
i tried that it didn't work

1 solution

Try setting the DisplayIndex[^] for all of the datagrid's columns.
 
Share this answer
 
Comments
PythonProgrammer 16-Aug-13 14:21pm    
tried that it didnt work

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