0

I have a datagridview with two columns.The user input on the cells most be a time(hh:mm:ss)(08:00:00). So what i wanna is when the user input the text , i detect the length of the text and replace the text with the necessary format and leave the user on edit mode on the cell. The problem its detect the text changed event on a cell on a datagridview.

Example:

  • input user : 815
  • cell out : 08:15:00

and leave the user on edit mode on the cell.

I tried this: Allow just numbers on a cell but without a solution, just don't detect when user press a key on a cell when its on edit mode.

Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
  • Try this link: http://atikpassion.blogspot.com.au/2015/01/wpf-datagrid-cell-textbox-change-event.html – Allanckw Sep 20 '17 at 15:20
  • The CellFormatting and CellParsing events can be used for this. For a known type such as a TimeSpan, I'd use a FormatProvider. Please read [ask] and take the [tour] – Ňɏssa Pøngjǣrdenlarp Sep 20 '17 at 15:21

0 Answers0