Focus text in textbox!

superbabicka

Member
Licensed User
Can anybody tell me how can I select (highlight) text in textbox after 3 seconds..?

I stuck with this:
When I finish with barcode scanning, the number is write in textbox.
When I click again on button for scanning the previous number is not disappear (in the same textbox), so scanner write after previous number like:

5310048000210 - First Scanning
3360372058861 - Second scanning

Result = 53100480002103360372058861

I want after First Scanning to focus textbox with highlight, and then when I push button again the previous text will be disappear in the same textbox and will be come new sanned number.

Any idea, or solution ..?
 

superbabicka

Member
Licensed User
I try to use Textbox1.Text="" after 3 seconds, but data in another textboxes automatically disappear when Textbox1.Text="", and I cannot see the customer data after Textbox1.Text=""...

Here (like LOOP) I use Barcode.dll from Erel.

Is there a way (with some command) :
On Next Form Action (Textbox1.Text="") - or something like that...?

Thanks
 

superbabicka

Member
Licensed User
OK I fix this !!!

:sign0060:

I create new textbox Out of loop and after timer_tick I fill all other textboxes in form :)

My Code:

Sub Form4_Show
Sbarkod.Text = ""
Sbarcode.New1("Form4","Sbarkod") 'this is Obj. Barcode.dll
TextTrial.Focus 'this is Invisible textbox
Timer3.Enabled=true
Timer3.Interval=200 'less then 1 second (2 millisecond)
End Sub

Sub Sbarcode_TextChanged
SCavt.Text = ""
SNameF.Text = ""
SNameL.Text = ""
SGender.Text = ""
SAddress.Text = ""
SCity.Text = ""
For i = 0 To Table1.RowCount - 1 'Table1 is table where I load CSV database
If Table1.Cell("Barcode",i) = Sbarkod.Text Then
SCavt.Text = Table1.Cell("CAVT Number",i)
SNameF.Text = Table1.Cell("First Name",i)
SNameL.Text = Table1.Cell("Last Name",i)
SGender.Text = Table1.Cell("Gender",i)
SAddress.Text = Table1.Cell("Address",i)
SCity.Text = Table1.Cell("City",i)
End If
Next
End Sub

Sub Timer3_Tick
Sbarkod.Text = TextTrial.Text 'Here I fill data into Sbarkod textbox
TextTrial.Focus
TextTrial.Text = ""
Timer3.Enabled=false
End Sub

Sub TextTrial_KeyPress (key) 'after this click Timer3 is enabled and read data from CSV again
Timer3.Enabled=true
End Sub


Thanks
 

superbabicka

Member
Licensed User
I cannot use ENTER

I cannot use ENTER because of next scanning...

If I use CHR(13) then will be again same number in the field.
But, your timer tick is helpful for me for another function ;)

Thank you for your post !
 

RandomCoder

Well-Known Member
Licensed User
You can still use a similar type of idea.
Just check for the text changing and count the number of ticks.
Reset the count everytime the text changes or if still "", when the count reaches 6 (if timer is set to 500ms) then you have your new value.

Regards,
RandomCoder
 
Top