c# - How may I automatically change focus from textBox1 to textBox2 after populating textBox1? -


i've created stock locater/mover program. scenario sequence follows:

  • first, user scan qr code textbox1 , scan location textbox2.
  • next, update statement execute resulting in 'moving' stock's location.

how auto move cursor textbox2 after textbox1 has been populated qr code?

please note qr codes vary in length. prevents me using textbox max length. i've tried following:

private void textbox1_textchanged(object sender, eventargs e)         {             //part number textbox             var partnumber = textbox1.text;             partnumber = partnumber.trimend('\r', '\n');              if (textbox1.text!=null)             {                 textbox1.select();             }             else             {                 textbox2.select();             }         } 

using aforementioned code, first character of qr code input textbox1 , remaining characters input textbox2. desire have qr code characters in textbox1 , have cursor change focus textbox2.

a similar issue has been described in question here on se.

the following answer, posted esskar might of interest you. since scanner take instant scan qr code textbox, might use technique in answer start timer when textchanged fires. i'd set interval of timer @ around 500ms, should enough, , once fires can pretty sure qr code inside textbox.

obviously isn't perfect solution, since in cases scanner might lag or unable deliver qr code in time-frame whatever reason.

you need implement check common qr code length , validate code before go on.

to clear: there's no need create new type of textbox. start timer when textchanged fired.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -