473,396 Members | 1,784 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.

simple problem...?!

Hi group,

I've got what seems a simple problem, but I can't find the solution. I've
got a textbox and a handheld scanner to scan barcodes, the scanner just
generates keypresses like a keyboard would so if I scan a barcode and the
number from this barcode is 4210, the scanner generates a keypress on the 4
than on the 2 than on 1 and finally on the 0. Now what's my problem, normaly
the barcodes' length always is 16 (so if the length of the textbox.text = 16
I select the entire text so the next barcode can be scanned), but If the
user for example scans the barcode wrong or to fast, only a piece of the
code is generated and my textbox length ain't 16 and the text doesn't get
selected, so if they scan a next barcode this barcode is wrong because it
fills the barcode textbox untill the length is 16 than selects the text and
continues with the remaining numbers. Now this would not be a big problem if
the user had a mouse or a keyboard but they only have got a scanner.

Any help is very welcome

thnx in advance Peter
Nov 21 '05 #1
12 1565
Peter,

I know almost nothing about barcodes.

However every string has a length property what can be tested.

dim a as string = "Hello"
if a.length <> 16 then 'messagebox.show("There is something wrong scan
again")

What do I mis in your problem?

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>

I've got what seems a simple problem, but I can't find the solution. I've
got a textbox and a handheld scanner to scan barcodes, the scanner just
generates keypresses like a keyboard would so if I scan a barcode and the
number from this barcode is 4210, the scanner generates a keypress on the
4
than on the 2 than on 1 and finally on the 0. Now what's my problem,
normaly
the barcodes' length always is 16 (so if the length of the textbox.text =
16
I select the entire text so the next barcode can be scanned), but If the
user for example scans the barcode wrong or to fast, only a piece of the
code is generated and my textbox length ain't 16 and the text doesn't get
selected, so if they scan a next barcode this barcode is wrong because it
fills the barcode textbox untill the length is 16 than selects the text
and
continues with the remaining numbers. Now this would not be a big problem
if
the user had a mouse or a keyboard but they only have got a scanner.

Any help is very welcome

thnx in advance Peter

Nov 21 '05 #2
Hi Cor,

I know about the length property, the problem you miss is that the text in
the textbox has to be selected for a new scan to completly overwrite the
text in the textbox, and that's the problem the complete text in the textbox
always has to be selected, I already wrote a piece of code to always select
the entire text in the text box but the problem with that was that it didn't
overwrite the selected text but just added text to it. This would be very
easy if the scanner generated an end of input event or something like that
but it works just like a keyboard and a keyboard also hasn't got a end of
input thingy.

I hope the I was a bit clearer this time :-)

Greetz Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uj**************@TK2MSFTNGP14.phx.gbl...
Peter,

I know almost nothing about barcodes.

However every string has a length property what can be tested.

dim a as string = "Hello"
if a.length <> 16 then 'messagebox.show("There is something wrong scan
again")

What do I mis in your problem?

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>

I've got what seems a simple problem, but I can't find the solution. I've got a textbox and a handheld scanner to scan barcodes, the scanner just
generates keypresses like a keyboard would so if I scan a barcode and the number from this barcode is 4210, the scanner generates a keypress on the 4
than on the 2 than on 1 and finally on the 0. Now what's my problem,
normaly
the barcodes' length always is 16 (so if the length of the textbox.text = 16
I select the entire text so the next barcode can be scanned), but If the
user for example scans the barcode wrong or to fast, only a piece of the
code is generated and my textbox length ain't 16 and the text doesn't get selected, so if they scan a next barcode this barcode is wrong because it fills the barcode textbox untill the length is 16 than selects the text
and
continues with the remaining numbers. Now this would not be a big problem if
the user had a mouse or a keyboard but they only have got a scanner.

Any help is very welcome

thnx in advance Peter


Nov 21 '05 #3
Peter,

Can you give a sample something as
Textbox contains 'xxxxxxxxxxxxx
Scanner contains 'xxxxxxxxxxxxxxxx

Result in textbox has to be 'xxxxxxxxxxxxx

Know that a 00 value ends a visiblestring however it still contains it.

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>
Hi Cor,

I know about the length property, the problem you miss is that the text in
the textbox has to be selected for a new scan to completly overwrite the
text in the textbox, and that's the problem the complete text in the
textbox
always has to be selected, I already wrote a piece of code to always
select
the entire text in the text box but the problem with that was that it
didn't
overwrite the selected text but just added text to it. This would be very
easy if the scanner generated an end of input event or something like that
but it works just like a keyboard and a keyboard also hasn't got a end of
input thingy.

I hope the I was a bit clearer this time :-)

Greetz Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uj**************@TK2MSFTNGP14.phx.gbl...
Peter,

I know almost nothing about barcodes.

However every string has a length property what can be tested.

dim a as string = "Hello"
if a.length <> 16 then 'messagebox.show("There is something wrong scan
again")

What do I mis in your problem?

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>
>
> I've got what seems a simple problem, but I can't find the solution. I've > got a textbox and a handheld scanner to scan barcodes, the scanner just
> generates keypresses like a keyboard would so if I scan a barcode and the > number from this barcode is 4210, the scanner generates a keypress on the > 4
> than on the 2 than on 1 and finally on the 0. Now what's my problem,
> normaly
> the barcodes' length always is 16 (so if the length of the textbox.text = > 16
> I select the entire text so the next barcode can be scanned), but If
> the
> user for example scans the barcode wrong or to fast, only a piece of
> the
> code is generated and my textbox length ain't 16 and the text doesn't get > selected, so if they scan a next barcode this barcode is wrong because it > fills the barcode textbox untill the length is 16 than selects the text
> and
> continues with the remaining numbers. Now this would not be a big problem > if
> the user had a mouse or a keyboard but they only have got a scanner.
>
> Any help is very welcome
>
> thnx in advance Peter
>
>



Nov 21 '05 #4
Cor,

here's an example:

I scan a barcode of normal length 16 and it returns me:

123456789abcdefh in the textbox and in the text changed event I check to see
if my textbox.text.length is 16 if this is the case I set the selectionstart
and length.

now the next barcode I scan is a wrong one and it returns only 10
characters:

123456789a to the textbox, in my text changed event I check and see that the
length isn't 16 so I don't set the selectionstart and length, but it should
be selected because if I do a new correct scan the text which was in the
textbox has to disapear.

If the scanner would send the entire string at once it wouldn't be a
problem, the textchanged event would do just fine but the scanner doesn't
send what it scans as a complete string, but it sends it like I would type
it in on a keyboard (character per character)

I hope this helps to clear it up

greetz Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
Peter,

Can you give a sample something as
Textbox contains 'xxxxxxxxxxxxx
Scanner contains 'xxxxxxxxxxxxxxxx

Result in textbox has to be 'xxxxxxxxxxxxx

Know that a 00 value ends a visiblestring however it still contains it.

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>
Hi Cor,

I know about the length property, the problem you miss is that the text in the textbox has to be selected for a new scan to completly overwrite the
text in the textbox, and that's the problem the complete text in the
textbox
always has to be selected, I already wrote a piece of code to always
select
the entire text in the text box but the problem with that was that it
didn't
overwrite the selected text but just added text to it. This would be very easy if the scanner generated an end of input event or something like that but it works just like a keyboard and a keyboard also hasn't got a end of input thingy.

I hope the I was a bit clearer this time :-)

Greetz Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uj**************@TK2MSFTNGP14.phx.gbl...
Peter,

I know almost nothing about barcodes.

However every string has a length property what can be tested.

dim a as string = "Hello"
if a.length <> 16 then 'messagebox.show("There is something wrong scan
again")

What do I mis in your problem?

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>
>
> I've got what seems a simple problem, but I can't find the solution.

I've
> got a textbox and a handheld scanner to scan barcodes, the scanner just > generates keypresses like a keyboard would so if I scan a barcode and

the
> number from this barcode is 4210, the scanner generates a keypress on

the
> 4
> than on the 2 than on 1 and finally on the 0. Now what's my problem,
> normaly
> the barcodes' length always is 16 (so if the length of the textbox.text
=
> 16
> I select the entire text so the next barcode can be scanned), but If
> the
> user for example scans the barcode wrong or to fast, only a piece of
> the
> code is generated and my textbox length ain't 16 and the text doesn't

get
> selected, so if they scan a next barcode this barcode is wrong
because it
> fills the barcode textbox untill the length is 16 than selects the

text > and
> continues with the remaining numbers. Now this would not be a big

problem
> if
> the user had a mouse or a keyboard but they only have got a scanner.
>
> Any help is very welcome
>
> thnx in advance Peter
>
>



Nov 21 '05 #5
Peter,

Sorry,

It still not is, how you know the scanner is ready.
(I hope you are not just looking for the method textbox.clear")

And just some short answers, more words does not clear it for me. You mis
something and I mis something (I do not see what tells that the barcode
action has ended).

Cor
Nov 21 '05 #6
Hi Cor

That's the problem nothing tells me that the barcode action has ended, it's
just the same as I would type in a 16 digit code in a textbox, there's no
event firing when I stop typing, the scanner just reads the barcode and
sends it to the screen character by character like I would do if I typed it
on my keyboard letter by letter

Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:#m**************@TK2MSFTNGP14.phx.gbl...
Peter,

Sorry,

It still not is, how you know the scanner is ready.
(I hope you are not just looking for the method textbox.clear")

And just some short answers, more words does not clear it for me. You mis
something and I mis something (I do not see what tells that the barcode
action has ended).

Cor

Nov 21 '05 #7
Peter,

Do you make the barcodes yourself? Do your barcodes end with any special
characters? Are they all the exact same length?

We print barcodes from our software. We put *'s at the beginning and the
end of the barcode. Then we have just check every time the text is
changed, if the string is larger than 1 and the last character is a *,
we move on to the next field... Just as an example...

Aaron

Peter Proost wrote:
Hi Cor

That's the problem nothing tells me that the barcode action has ended, it's
just the same as I would type in a 16 digit code in a textbox, there's no
event firing when I stop typing, the scanner just reads the barcode and
sends it to the screen character by character like I would do if I typed it
on my keyboard letter by letter

Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:#m**************@TK2MSFTNGP14.phx.gbl...
Peter,

Sorry,

It still not is, how you know the scanner is ready.
(I hope you are not just looking for the method textbox.clear")

And just some short answers, more words does not clear it for me. You mis
something and I mis something (I do not see what tells that the barcode
action has ended).

Cor


--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.
Nov 21 '05 #8
Peter,

However it is scanning, and than doing if it is typing.

So with the first keypress you can set a timer, and than when there are some
milliseconds gone you can test if it is done.

As you wrote it is simple in my opinion. I think that it can be something as
the sample bellow.

However I cannot do the timing that you have to set yourself, because this
what I set is to slow

\\\
Private WithEvents timer1 As New Timer
Private firstkey As Boolean
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e _
As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If firstkey = False Then
timer1.Enabled = True
timer1.Interval = 1000
End If
End Sub
Private Sub timer1_Tick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles timer1.Tick
firstkey = False
timer1.Enabled = False
If TextBox1.Text.Length < 16 Then
MessageBox.Show("something was wrong")
End If
End Sub
///

I hope this helps?

Cor

"Peter Proost" <pp*****@nospam.hotmail.com>

That's the problem nothing tells me that the barcode action has ended,
it's
just the same as I would type in a 16 digit code in a textbox, there's no
event firing when I stop typing, the scanner just reads the barcode and
sends it to the screen character by character like I would do if I typed
it
on my keyboard letter by letter

Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:#m**************@TK2MSFTNGP14.phx.gbl...
Peter,

Sorry,

It still not is, how you know the scanner is ready.
(I hope you are not just looking for the method textbox.clear")

And just some short answers, more words does not clear it for me. You mis
something and I mis something (I do not see what tells that the barcode
action has ended).

Cor


Nov 21 '05 #9
Hi Cor thnx for your time, I've found a solution... and a very easy one, at
first I was told that there wasn't a possibility to connect a mouse to the
terminal on which the programm has to run using citrix, but now I got one in
my hands and a mouse port is available, so problem solved thnx again for
your time and effort and I'll tell the hardware guy at work to look better
in the future thnx again
"Cor Ligthert" <no************@planet.nl> wrote in message
news:OT**************@TK2MSFTNGP09.phx.gbl...
Peter,

However it is scanning, and than doing if it is typing.

So with the first keypress you can set a timer, and than when there are some milliseconds gone you can test if it is done.

As you wrote it is simple in my opinion. I think that it can be something as the sample bellow.

However I cannot do the timing that you have to set yourself, because this
what I set is to slow

\\\
Private WithEvents timer1 As New Timer
Private firstkey As Boolean
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e _
As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If firstkey = False Then
timer1.Enabled = True
timer1.Interval = 1000
End If
End Sub
Private Sub timer1_Tick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles timer1.Tick
firstkey = False
timer1.Enabled = False
If TextBox1.Text.Length < 16 Then
MessageBox.Show("something was wrong")
End If
End Sub
///

I hope this helps?

Cor

"Peter Proost" <pp*****@nospam.hotmail.com>

That's the problem nothing tells me that the barcode action has ended,
it's
just the same as I would type in a 16 digit code in a textbox, there's no event firing when I stop typing, the scanner just reads the barcode and
sends it to the screen character by character like I would do if I typed
it
on my keyboard letter by letter

Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:#m**************@TK2MSFTNGP14.phx.gbl...
Peter,

Sorry,

It still not is, how you know the scanner is ready.
(I hope you are not just looking for the method textbox.clear")

And just some short answers, more words does not clear it for me. You mis something and I mis something (I do not see what tells that the barcode
action has ended).

Cor



Nov 21 '05 #10
Peter Proost wrote:
Cor,

here's an example:

I scan a barcode of normal length 16 and it returns me:

123456789abcdefh in the textbox and in the text changed event I check to see
if my textbox.text.length is 16 if this is the case I set the selectionstart
and length.

now the next barcode I scan is a wrong one and it returns only 10
characters:

123456789a to the textbox, in my text changed event I check and see that the
length isn't 16 so I don't set the selectionstart and length, but it should
be selected because if I do a new correct scan the text which was in the
textbox has to disapear.

If the scanner would send the entire string at once it wouldn't be a
problem, the textchanged event would do just fine but the scanner doesn't
send what it scans as a complete string, but it sends it like I would type
it in on a keyboard (character per character)

I hope this helps to clear it up

greetz Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:ud**************@TK2MSFTNGP11.phx.gbl...
Peter,

Can you give a sample something as
Textbox contains 'xxxxxxxxxxxxx
Scanner contains 'xxxxxxxxxxxxxxxx

Result in textbox has to be 'xxxxxxxxxxxxx

Know that a 00 value ends a visiblestring however it still contains it.

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>
Hi Cor,

I know about the length property, the problem you miss is that the text
in
the textbox has to be selected for a new scan to completly overwrite the
text in the textbox, and that's the problem the complete text in the
textbox
always has to be selected, I already wrote a piece of code to always
select
the entire text in the text box but the problem with that was that it
didn't
overwrite the selected text but just added text to it. This would be
very
easy if the scanner generated an end of input event or something like
that
but it works just like a keyboard and a keyboard also hasn't got a end
of
input thingy.

I hope the I was a bit clearer this time :-)

Greetz Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uj**************@TK2MSFTNGP14.phx.gbl...

Peter,

I know almost nothing about barcodes.

However every string has a length property what can be tested.

dim a as string = "Hello"
if a.length <> 16 then 'messagebox.show("There is something wrong scan
again")

What do I mis in your problem?

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>

>I've got what seems a simple problem, but I can't find the solution.

I've

>got a textbox and a handheld scanner to scan barcodes, the scanner
just
generates keypresses like a keyboard would so if I scan a barcode and

the

>number from this barcode is 4210, the scanner generates a keypress on

the

>4
>than on the 2 than on 1 and finally on the 0. Now what's my problem,
>normaly
>the barcodes' length always is 16 (so if the length of the
textbox.text
=

>16
>I select the entire text so the next barcode can be scanned), but If
>the
>user for example scans the barcode wrong or to fast, only a piece of
>the
>code is generated and my textbox length ain't 16 and the text doesn't

get

>selected, so if they scan a next barcode this barcode is wrong
because
it

>fills the barcode textbox untill the length is 16 than selects the
text
and
>continues with the remaining numbers. Now this would not be a big

problem

>if
>the user had a mouse or a keyboard but they only have got a scanner.
>
>Any help is very welcome
>
>thnx in advance Peter
>
>


Use a timer with a timeout of 1 second? Scanning it is like typing very
fast. If the textbox isn't full within that second clear it.

--
Rinze van Huizen
C-Services Holland b.v.
Nov 21 '05 #11
Rinze,


Use a timer with a timeout of 1 second? Scanning it is like typing very
fast. If the textbox isn't full within that second clear it.

That is exactly my sample from yesterday. Why you write this.

However Peter did not needed it anymore.

Cor
Nov 21 '05 #12
Cor Ligthert wrote:
Rinze,
Use a timer with a timeout of 1 second? Scanning it is like typing very
fast. If the textbox isn't full within that second clear it.


That is exactly my sample from yesterday. Why you write this.

However Peter did not needed it anymore.

Cor

Hmm sorry, I missed that post before replying.. my bad

--
Rinze van Huizen
C-Services Holland b.v.
Nov 21 '05 #13

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

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
6
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I don´t know much javascript so I wrote a very simple one to validate a form I have on my webpage. ...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
18
by: Sender | last post by:
Yesterday there was a very long thread on this query. (You can search on this by post by 'sender' with subject 'Simple Problem' post date Oct 7 time 1:43p) And in the end the following code was...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
2
by: Vitali Gontsharuk | last post by:
Hi! I have a problem programming a simple client-server game, which is called pingpong ;-) The final program will first be started as a server (nr. 2) and then as a client. The client then...
8
by: rdrink | last post by:
I am just getting into pysqlite (with a fair amount of Python and MySQL experience behind me) and have coded a simple test case to try to get the hang of things... yet have run into a 'stock...
5
by: Chelong | last post by:
hey,the follow is the text file content ========================================apple====pear== one Lily 7 0 0 7 7 two Lily 20 20 6.6666 20 8 one Lily 0 10 2.85 4 0 two Lily 22 22 7.33326 2 5 ...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
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: 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
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,...
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
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,...
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...
0
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...
0
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...
0
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,...

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.