My VB6 has a Form with a Textbox.
Actually my work behind reading Barcode thru Barcode Reader into the
TextBox, The Maxlength of the TextBox is 12.
If I Input some characters manually into the TextBox Say "abc" (without quotes)
now the cursor is in 4th place from there it won't allow Barcode Reader to read.
It should start from 1st place only by erasing already existing 3 characters.
This is my situation.

if the above question is not clear

don't use
Text1.SelStart =0
Text1.SelLength = Len(Text1.Text)
in Got_Focus Event.

After typing "ABC" (without quotes) the cursor is in 4th place ok. My barcode length is 12 characters.
When I read barcode thru reader it starts from 4th place
& the last three characters of barcode cut off due to max.
length of the Textbox is 12.
What i want is before reading barcode the already existing
Characters "ABC" (without quotes) in the Textbox should be cleared.

Recommended Answers

All 3 Replies

Tell me little clearly ,when that 3 charaters before or after the barcode reader sends the data,

if it is before, then simple you can use text1.text="",else
you better to get the barcode reader value in a string and then use it,

if this not helps to you, give more details (step by step process...)

With regards
Venkatramasamy SN

Thnks Venkat for you reply.
what I need is Just type anything in the TextBox before reading thru Barcoder
ex. "abc" (without quotes) now the cursor is in the 4th place of the Textbox
At that time when I read thru Barcoder the existing "abc" or any text to be vanished.
This is my task.
H've any soln. for this.?

HI Rajesh,

i gues that your task may like this...

you need 3 charater to be typed before the barcode reading
2. the barcode lenght is 12

3. the text box maxsize 12

my view
i dont know why you typ ethe 3 charaters, if you want to delete that later, while reading the barcode....

if you need concatenate the both
take the textbox string to an stringvariable and then clear the textbox

then concatenate the previous string with the textbox string(Barcode)....

now your string variable will contain the Barcode along with the #chars as orefix
dim Barcode as string
(3Chars= abc)
'now read the Barcode
Barcode=Barcode & text1.text

if you dont need that 3 chars then simple use
before you reading the Barcode

hope this will help you,

with regards
Venkatramasamy SN

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.