以文本方式查看主题
- Foxtable(狐表) (http://foxtable.net/bbs/index.asp)
-- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2)
---- 请教扫描枪 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=95307)
|
-- 作者:jamhuton
-- 发布时间:2017/1/16 14:46:00
-- 请教扫描枪
[)><RS>06<GS>Z<GS>1JF10117010903089<GS>Q12<GS>PTIG5820800A<GS>V<GS>1T20170109<GS>K<GS>N<GS>21L700<RS><EOT>
如何把扫描枪扫描的数据分割到每个列?
|
-- 作者:有点色
-- 发布时间:2017/1/16 14:54:00
--
Dim str As String = "<RS>06<GS>Z<GS>1JF10117010903089<GS>Q12<GS>PTIG5820800A<GS>V<GS>1T20170109<GS>K<GS>N<GS>21L700<RS><EOT>" str = str.replace("<GS>", "@") Dim ary() As String = str.split("@") For i As Integer = 0 To ary.length-1 output.show(ary(i)) Next
|
-- 作者:jamhuton
-- 发布时间:2017/1/16 15:32:00
--
RS>06<GS>Z<GS>1JF10117010903089<GS>Q12<GS>PTIG5820800A<GS>V<GS>1T20170109<GS>K<GS>N<GS>21L700<RS><EOT>
1、红色字部分是变化的,不同的条码是不同 的 2、目前就是想把红色字部分扫描填入表中 3、代码写在datecolchanged?
|
-- 作者:有点色
-- 发布时间:2017/1/16 15:44:00
--
看懂代码,修改,把代码写到你需要的位置
Dim str As String = "<RS>06<GS>Z<GS>1JF10117010903089<GS>Q12<GS>PTIG5820800A<GS>V<GS>1T20170109<GS>K<GS>N<GS>21L700<RS><EOT>" str = str.replace("<GS>", "@").replace("<RS>", "@") Dim ary() As String = str.split("@") \'For i As Integer = 0 To ary.length-1 \'msgbox(ary(i)) \'Next msgbox(ary(1)) msgbox(ary(2))
|
-- 作者:jamhuton
-- 发布时间:2017/1/19 11:19:00
--
此主题相关图片如下:3.png

4楼代码我写在窗口的keydown,图上的我是手工填入的
Dim str As String = "<RS>箱号<GS>Z<GS>1J编号<GS>Q数量<GS>品番<GS>V<GS>1T进库日期<GS>K<GS>N<GS>发票号码<RS><EOT>" str = str.replace("<GS>", "@").replace("<RS>", "@") Dim ary() As String = str.split("@") \'For i As Integer = 0 To ary.length-1 \'msgbox(ary(i)) \'Next msgbox(ary(1)) msgbox(ary(2))
[此贴子已经被作者于2017/1/19 11:22:24编辑过]
|
-- 作者:有点色
-- 发布时间:2017/1/19 11:44:00
--
DataColChanged事件
If e.DataCol.Name = "ID" Then Dim str As String = e.DataRow("ID") str = str.replace("<GS>", "@").replace("<RS>", "@") Dim ary() As String = str.split("@") If ary.length > 3 Then e.DataRow("箱号") = ary(1) e.DataRow("Z") = ary(2) End If End If
|
-- 作者:jamhuton
-- 发布时间:2017/1/19 14:01:00
--
1JF10117010903089
字符串截取,扫描输入的时候读取上面的字符填充可以了,我想填充进去的数据去掉前面2个字符,代码写哪里?
|
-- 作者:有点色
-- 发布时间:2017/1/19 15:21:00
--
If e.DataCol.Name = "ID" Then Dim str As String = e.DataRow("ID") str = str.replace("<GS>", "@").replace("<RS>", "@") Dim ary() As String = str.split("@") If ary.length > 3 Then e.DataRow("箱号") = ary(1) e.DataRow("Z") = ary(2)
e.DataRow("编号") = ary(3).SubString(2) End If End If
|
-- 作者:jamhuton
-- 发布时间:2017/1/19 15:22:00
--
谢谢老师
|
-- 作者:jamhuton
-- 发布时间:2017/1/19 16:04:00
--
此主题相关图片如下:4.png

如何绑定到关联表的子表进行扫描输入,有些数据需要从主表引用过来的
[此贴子已经被作者于2017/1/19 16:06:18编辑过]
|