hi

i am validating cells in the datagrid in datagrid celleditending event.
if the validation fails message is diplayed in the message box when i click
ok in the message box the focus move to the previous row .i want the focus in the current validated cell i try this code
but it didn't work.
int index = attendancegrid .SelectedIndex;
attendancegrid .SelectedItem = attendancegrid .Items[index];
attendancegrid .ScrollIntoView(attendancegrid .Items[index]);

if anyone knows how to focus the current cell when validation fails give some
sample code

If you're using a Validating event handler. Setting e.Cancelled true will send the focus back to the originating cell.