[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3595
  • Last Modified:

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?
0
MBND
Asked:
MBND
  • 2
1 Solution
 
deepu chandranCommented:
0
 
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.  

0
 
SimpsonThePhilCommented:
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.

Phil
0
 
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.  
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now