473,396 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP.Net and Barcode Scanner

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:
WithEvents _comPort As New IO.Ports.SerialPort
Delegate Sub SetValue(ByVal barcode As String)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
' Initialize the scanner.
End Sub

Sub ShowValue(ByVal barcode As String)
TextBox1.Text = barcode
End Sub

Private Sub ReadBarcode(ByVal sender As Object, ByVal e As
IO.Ports.SerialDataReceivedEventArgs) Handles _comPort.DataReceived

Dim value As String
Dim targetMethod As Reflection.MethodInfo =
Me.GetType().GetMethod("ShowValue")
Dim deleg As SetValue =
DirectCast([Delegate].CreateDelegate(GetType(SetValue), Me,
targetMethod), _
SetValue)

value = _comPort.ReadLine
deleg.Invoke(value)
End Sub
Can somebody help me please!
Thanks

Chris

Jul 26 '07 #1
2 4884
hi,
you seem to do everything server side... but I think what you want to
achieve should be done client-side. imagine if you were to start 2 clients
connected to the page, which one your server will send the text to? (both?)
and it would mean the scanner is plugged in your server, which may not be
what you want.

I think the solution will be to get the value using javascript... can
javascript interact with COM ports, not that I know of...

The solution you may have is to install certain drivers (some serial scanner
have) so the input from your scanner is translated as if it were typed on
the keyboard. Then you'd not have to worry anymore about your scanner.

I hope it helps

ThunderMusic

<ch********@hotmail.comwrote in message
news:11**********************@b79g2000hse.googlegr oups.com...
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:
WithEvents _comPort As New IO.Ports.SerialPort
Delegate Sub SetValue(ByVal barcode As String)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
' Initialize the scanner.
End Sub

Sub ShowValue(ByVal barcode As String)
TextBox1.Text = barcode
End Sub

Private Sub ReadBarcode(ByVal sender As Object, ByVal e As
IO.Ports.SerialDataReceivedEventArgs) Handles _comPort.DataReceived

Dim value As String
Dim targetMethod As Reflection.MethodInfo =
Me.GetType().GetMethod("ShowValue")
Dim deleg As SetValue =
DirectCast([Delegate].CreateDelegate(GetType(SetValue), Me,
targetMethod), _
SetValue)

value = _comPort.ReadLine
deleg.Invoke(value)
End Sub
Can somebody help me please!
Thanks

Chris

Jul 26 '07 #2
The solution you may have is to install certain drivers (some serial scanner
have) so the input from your scanner is translated as if it were typed on
the keyboard. Then you'd not have to worry anymore about your scanner.

I hope it helps
Thanks for the idea!

Did not found this option in the drivers but I made a program in
VB.Net that redirect the COMPort Input to keyboard and it's working
fine!

Chris

Jul 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: CHANGE username to westes | last post by:
What are the most popular, and well supported, libraries of drivers for bar code scanners that include a Visual Basic and C/C++ API? My requirements are: - Must allow an application to be...
8
by: DS | last post by:
Does anyone know anything about barcodes in Access. I don't want to create them in Access. I merely want to scan whats already been created. I need to scan Liquor bottles. I have the scanner...
1
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...
6
by: Samuel Shulman | last post by:
I would like to add barcode functionality to my POS program How does one attach barcode reader is it usually USB port How can the program get the data read by the device Thank you, Samuel
2
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...
4
by: djbaker | last post by:
Greetings, I would like to integrate a barcode scanner into the current project I am working on. I have been looking around teh web and with the exception of embeded devices I cannot find many...
7
by: Alper Ozgur | last post by:
Hi; How can i capture and decode the barcode that reading by an usb Barcode reader?
2
by: nmrpa91290 | last post by:
Hi, I am in the design phase of building a database that will track the productivity of my warehouse. I am thinking of using a barcode scanner to assist me with this. Employees will hopefully...
7
by: jim | last post by:
I need to have 2 simple barcode reader applications finished by midnight tonight. I have never written any barcode reader software and need any help that you may be able to offer. I do not know...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.