Remove carriage return from barcode scan into textbox column in dataGridView

The user is using a barcode scanner that has a carriage return, to scan a barcode into a dataGridView textbox column.  I need to remove that carriage return so the focus stays in the current cell after the scan.  I know I can do a string.replace to remove the "\r\n"  but I cannot catch it in the correct event. Any ideas?

Key down, key press and key up events do not work as it is too the the carriage return already executed and the focus is in the new row.  I was thinking CellBeginEdit or CellValidating but don't know how I could strip off the carriage return in those events?
Who is Participating?
Configure the scanner to remove the post-amables from the scan.  You will see this in the programming guide for the barcode scanner and usually involves scanning a few programming barcodes.  This is the most straight forward method as it envolves no software changes.

deepu chandranCommented:
MBNDAuthor Commented:
The link shows how to do a string.replace which I know how to do....the problem is what event can this be done in for my situation described above.  

MBNDAuthor Commented:
I ended up focusing in the dataGridViewCell that i wanted to be in after the carriage return.  This has solved my problem for now.  

Phil - thanks for the suggestion but in this case, in this app the carriage return is needed in all other instances.  
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.