how can I highlight a whole row in datagrid programmatically??

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

thx all
for example,
I want to highlight the end of the whole row every time when the form load
 
Do you want to select the last row in the DataGrid? If so then find out the
index of the last row in the DataGrid, based on the DataSource, and then use
the Select(int) method of the DataGrid. You will probably also want to set
the current row to the selected row as well and for that you would use the
CurrentRowIndex property.

this.dataGrid1.CurrentRowIndex = lastRowIndex;
this.dataGrid1.Select(lastRowIndex);
 
thx

Tim Wilson said:
Do you want to select the last row in the DataGrid? If so then find out the
index of the last row in the DataGrid, based on the DataSource, and then use
the Select(int) method of the DataGrid. You will probably also want to set
the current row to the selected row as well and for that you would use the
CurrentRowIndex property.

this.dataGrid1.CurrentRowIndex = lastRowIndex;
this.dataGrid1.Select(lastRowIndex);
 
Back
Top