How to disable some columns in datagrid.

smriti

Regular
Joined
Jan 7, 2005
Messages
54
Dear friends,

I want to disable two of my columns of windows forms datagrid.
I am already using tablestyles and making
the readonly property of both the columns to false.

But on clicking the cell with mouse the cell is highlighting.
How to prevent this.

please helpl me.

Thanks
 
You should be able to adapt this:

Code:
    Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged

        If Me.DataGrid1.CurrentCell.ColumnNumber = 0 Then

            Me.DataGrid1.CurrentCell = New DataGridCell(Me.DataGrid1.CurrentRowIndex, 1)

        End If

    End Sub
 
Machaira said:
You should be able to adapt this:

Code:
    Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged

        If Me.DataGrid1.CurrentCell.ColumnNumber = 0 Then

            Me.DataGrid1.CurrentCell = New DataGridCell(Me.DataGrid1.CurrentRowIndex, 1)

        End If

    End Sub


Thanks a lot.
It did most of my work.
but now i don't want to set focus on any column
how to do this.

Thanks.
 
Back
Top