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
5 21019
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
Stewart raises a valid point, but if you absolutely must do this , this code will do the job: - Private Sub txtBarCode_KeyDown(KeyCode As Integer, Shift As Integer)
-
KeyCode = 0
-
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)> 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.
This is how I solved it: -
Public FirstInput As Date
-
-
Private Sub Text0_GotFocus()
-
FirstInput = Empty
-
End Sub
-
-
-
Private Sub Text0_KeyUp(KeyCode As Integer, Shift As Integer)
-
Dim TimeDiff As Integer
-
'Procedure uses first keystroke to start timing, and every subsequent keystroke compares
-
'to the first, and if more than 1 second has elapsed, warns user to use the scanner and resets field.
-
'tabbing away or back to the field resets the timer. Tabbing off the field or hitting enter to move to
-
'the next field will not be counted as keystrokes.
-
-
If KeyCode <> 9 And KeyCode <> 13 Then
-
If FirstInput = Empty Then
-
FirstInput = Now()
-
Else
-
TimeDiff = DateDiff("s", FirstInput, Now())
-
End If
-
-
If TimeDiff > 1 Then
-
MsgBox ("Please scan in using the attached scanner")
-
Text0.Text = Empty
-
FirstInput = Empty
-
End If
-
-
End If
-
-
End Sub
-
-
Private Sub Text0_LostFocus()
-
FirstInput = Empty
-
End Sub
-
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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.
|
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...
|
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.
| |
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?
|
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:
|
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.
|
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...
|
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...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |