468,505 Members | 1,586 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

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 1381
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Patchwork | last post: by
reply views Thread by 42 | last post: by
18 posts views Thread by Sender | last post: by
27 posts views Thread by one man army | last post: by
2 posts views Thread by Vitali Gontsharuk | last post: by
8 posts views Thread by rdrink | last post: by
5 posts views Thread by Chelong | last post: by
30 posts views Thread by galiorenye | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.