troubleshooting Question

Remove carriage return from barcode scan into textbox column in dataGridView

Avatar of MBND
MBND asked on
Microsoft SQL ServerC#
4 Comments1 Solution4763 ViewsLast Modified:
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?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros