datagrid focusing on a specific cell based on column name

  • Thread starter Thread starter jamie
  • Start date Start date
J

jamie

I have a datagrid that is linked to a dataset. I want to set focus to the
datagrid at a specific column. I know the row number (0) but I can't
find an easy way to figure out where column["species"] is. Normally I make
a temporary dataGridCell and set it to be at row 0 column 1 and then make
the datagrid.currentcell = the temportary cell but I can't seem to get the
column number back to use that. Any ideas?

Jamie
 
Are you trying to figure out column's ordinal in the grid? If so, something
like this should do:

int ordinal =
dataGrid.TableStyles["table"].GridColumnStyles.IndexOf(dataGrid.TableStyles["table"].GridColumnStyles["column"]);

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

jamie said:
Noone has ever tried to do this based on column name?
jamie said:
I have a datagrid that is linked to a dataset. I want to set focus to the
datagrid at a specific column. I know the row number (0) but I can't
find an easy way to figure out where column["species"] is. Normally I
make a temporary dataGridCell and set it to be at row 0 column 1 and then
make the datagrid.currentcell = the temportary cell but I can't seem to
get the column number back to use that. Any ideas?

Jamie
 
Back
Top