Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i make a column in a datagrid not be a tabstop?

Status
Not open for further replies.

Blitz

Technical User
Jul 7, 2000
171
US
I made an unbound column in my datagrid using the example at the problem is that even though it cant be edited or selected the grid still tries to tab to it so that the column before it has to be tabbed out of twice. (the example available for download has the same problem) any idea how to fix this?
 
if anyone else has this problem i solved it using this example

//columns 3-6 are hidden with 0-column width...

private int LEFTHIDDENCOLUMN = 3;

private int RIGHTHIDDENCOLUMN = 6;



private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)

{

if(dataGrid1.CurrentCell.ColumnNumber == LEFTHIDDENCOLUMN)

dataGrid1.CurrentCell = new DataGridCell(dataGrid1.CurrentCell.RowNumber + 1, 0);

else if(dataGrid1.CurrentCell.ColumnNumber == RIGHTHIDDENCOLUMN)

dataGrid1.CurrentCell = new DataGridCell(dataGrid1.CurrentCell.RowNumber, LEFTHIDDENCOLUMN - 1);

}
 
do you have vb.net version of it? I'm not familiar with c# so if someone could convert to vb .net can you post it here.

Thanks!!1
 
Private LEFTHIDDENCOLUMN As Integer = 3

Private RIGHTHIDDENCOLUMN As Integer = 6


Private Sub datagrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles datagrid1.CurrentCellChanged

If datagrid1.CurrentCell.ColumnNumber = Me.LEFTHIDDENCOLUMN Then

datagrid1.CurrentCell = New DataGridCell(Me.datagrid1.CurrentCell.RowNumber + 1, 0)

ElseIf datagrid1.CurrentCell.ColumnNumber = Me.RIGHTHIDDENCOLUMN Then

Me.datagrid1.CurrentCell = New DataGridCell(Me.datagrid1.CurrentCell.RowNumber, Me.LEFTHIDDENCOLUMN - 1)

End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top