Android Question How to implement EditText1 text box with barcode scanner to automatically run other code after scanning the barcode

bskotu555

Member
I have tried three methods, EditText_2_TextChanged, EditText_2EnterPressed, and EditText_2FocusChanged (HasFocus As Boolean), but none of them have worked
 

zed

Active Member
Licensed User
In the designer, right-click on your edittext, and select the desired option.
Aeric is right. There's no reason why it shouldn't work.
 
Upvote 0

bskotu555

Member
In the designer, right-click on your edittext, and select the desired option.
Aeric is right. There's no reason why it shouldn't work.
After some research, it was found that after selecting the single line option, the PDA scanned the built-in line breaks, which caused the failure. The combination of the two factors ultimately resolved the issue by using the text box entry event in conjunction with line break replacement. The relevant code is as follows:
Private Sub EditText2_EnterPressed
If EditText2.Text<>"" Then
Dim nm As String,strSQL As String,sqlstr As String,jt As String,tm As String
Dim Cursor As JdbcResultSet
Dim cx As String =Regex.Split(":",Button3.Text)(1)'提取程序名
Dim zw As String =Regex.Split(Chr(10),EditText1.text)(0)'获取站位,因为PDA自带换行必须替换掉换行符
Dim bt As String =Regex.Split(Chr(10),EditText2.text)(0)'获取物料条码,因为PDA自带换行必须替换掉换行符
strSQL ="SELECT * FROM program where cxnm='" & cx & "'and zwnm='" & zw & "'"'双条件查询语句and紧贴'符号+数据库名称一定要用英文!!!!
Cursor = Starter.Mysql_Jdbc.ExecQuery(strSQL) '查询结果
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…