473,654 Members | 3,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prevent user keying by keyboard and can only input by barcode scanner

1 New Member
Hi,

I intend to use barcode for input and prevent user to modify the barcode they scan, user are not allow to input the barcode number by keyboard.



Please advise how to do this.

Thanks.

Regards,
Alvin
Jul 16 '08 #1
5 21019
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. Most barcode scanners for PCs use the keyboard connection, and the scan behaves just as if you had typed the value. I can see no way to prevent users either keying the barcode directly, or altering it once a barcode has been scanned.

Even if you could implement such a facility, you would also be stopping users from manually keying barcodes if the scan fails for some reason.

-Stewart
Jul 20 '08 #2
missinglinq
3,532 Recognized Expert Specialist
Stewart raises a valid point, but if you absolutely must do this , this code will do the job:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtBarCode_KeyDown(KeyCode As Integer, Shift As Integer)
  2.   KeyCode = 0
  3. End Sub
Or you could simply set the textbox's Locked Property to Yes. I don't have a scanner, so I can't really test this, but both methods appear to handle your situation.

Welcome to Bytes!

Linq ;0)>
Jul 20 '08 #3
Delerna
1,134 Recognized Expert Top Contributor
I have done both of those for the purpose of obtaining part labels.
Stop the user entering maually similar to missinglig's code.
Stopped production getting labels because the scanner failed.

We finished up enabling users to manually enter part numbers, but we deliberately made it more difficult to obtain them that way than by using the scanner. It worked :)

Edit
Actually, on second thoughts, I think I may have had to wrap the barcoded number up in special characters and check the entered number for the presence of those characters before allowing the entry.
Jul 21 '08 #4
IAMREALITY
1 New Member
This is how I solved it:

Expand|Select|Wrap|Line Numbers
  1. Public FirstInput As Date
  2.  
  3. Private Sub Text0_GotFocus()
  4. FirstInput = Empty
  5. End Sub
  6.  
  7.  
  8. Private Sub Text0_KeyUp(KeyCode As Integer, Shift As Integer)
  9. Dim TimeDiff As Integer
  10. 'Procedure uses first keystroke to start timing, and every subsequent keystroke compares
  11. 'to the first, and if more than 1 second has elapsed, warns user to use the scanner and resets field.
  12. 'tabbing away or back to the field resets the timer. Tabbing off the field or hitting enter to move to
  13. 'the next field will not be counted as keystrokes.
  14.  
  15. If KeyCode <> 9 And KeyCode <> 13 Then
  16. If FirstInput = Empty Then
  17. FirstInput = Now()
  18. Else
  19. TimeDiff = DateDiff("s", FirstInput, Now())
  20. End If
  21.  
  22. If TimeDiff > 1 Then
  23. MsgBox ("Please scan in using the attached scanner")
  24. Text0.Text = Empty
  25. FirstInput = Empty
  26. End If
  27.  
  28. End If
  29.  
  30. End Sub
  31.  
  32. Private Sub Text0_LostFocus()
  33. FirstInput = Empty
  34. End Sub
  35.  
Sep 21 '16 #5
ADezii
8,834 Recognized Expert Expert
You can actually disable all User Input via the Mouse and Keyboard then re-enable it via the API, but this may be somewhat extreme.
Sep 21 '16 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6179
by: Darren Coleman | last post by:
I need help with 2 keyboard/input questions 1. How do i caputre all keypress events for my application/form? 2. How do I determine which keyboard sent the keypress? What i'm doing is using a USB Barcode scanner, windows sees the scanner as a keyboard. When the scanner reads a barcode it decodes the barcode and sends in the decoded values in as keypresses from a keyboard. I want to be able to tell the diffrence between a keypress from a...
4
4522
by: teddysnips | last post by:
I posted yesterday about a project I'm involved in to build a login application using a barcode scanner. I've solved most of the problems, but one remains. The client want to disable keyboard input (except at some remote sites where there won't be a scanner). The session "knows" whether that site should be keyboard enabled, but unfortunately the output from the scanner is in the form of keypresses! So any attempt to capture and...
2
2379
by: Frank Rizzo | last post by:
I have a barcode scanner that hooks up to a keyboard port. I've figured out how to setup a system-wide keyboard hook. However, how do I distinguish regular keyboard input from the barcode scanner input. Does anyone have any ideas? Thanks.
1
11222
by: Louis Cypher | last post by:
I'm working on an application (OEM) using c# that uses input from a keyboard and a USB Barcode Scanner. I need to be able to identify keystrokes from the barcode scanner and remove them from the message queue, regardless of what application has focus. I can identify the keystrokes and input device by registering for raw input (RegisterRawInputDevices) and processing the WM_INPUT message. This gives me the keystrokes and the ability to...
2
5750
by: Jay | last post by:
I have a barcode scanner with a USB interface. It acts as a keyboard (ie if I scan a barcode, it is placed at the text cursor as if I'd typed it on the keyboard). I'd like to bypass this behaviour so barcodes don't go to the text cursor, but instead go into my C# programme, even if it doesn't have focus. How do I do this? I somehow need to re-asign its output to my C# programme.
1
1968
by: thesayan | last post by:
i am writing in vb 2005 and i want to take input from a barcode scanner, run it through an invisible form in the background, and output something different than the barcode. but the trick is making it intercept the scanner input but NOT keyboard input. any thoughts?
2
4907
by: chris_gpf1 | last post by:
Hi, I'm working on a website where the user will have to scan a barcode with a serial barcode scanner. I get the scanner working and reading the barcode, but when I want to write the string in a Textbox, it's not working. The Textbox remain blank. Here's the code:
4
20213
by: Gerry19 | last post by:
Hi All, I'm trying to monitor data passed from a USB Barcode scanner but I can't find any decent code examples of what I need to do, including any references I need to include. I know I need to use RegisterRawInputDevices & WM_INPUT but have no idea where to start. Any help greatly appreciated.
2
3441
by: tomwilliams | last post by:
Hi I have created a website which has a number of buttons on it which allow users to add items to there basket, they then click on an AJAX watermarked textbox to set focus before using a keyboard wedge scanner to scan there staff ID card, this causes a postback and validates the user - all works perfectly. My problem is caused if the user attempts to scan their card before clicking on the watermarked textbox. This then forces a postback...
0
8380
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.