Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

ASP.Net and Barcode Scanner

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
chris_gpf1@hotmail.com - 26 Jul 2007 19:59 GMT
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
ThunderMusic - 26 Jul 2007 20:56 GMT
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

> Hi,
> I'm working on a website where the user will have to scan a barcode
[quoted text clipped - 37 lines]
>
> Chris
chris_gpf1@hotmail.com - 27 Jul 2007 16:45 GMT
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.