以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] 在窗口中按顺序自动查找下一个值 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=89696) |
-- 作者:18804248860 -- 发布时间:2016/8/27 10:54:00 -- [求助] 在窗口中按顺序自动查找下一个值 老师好,一个表中的点检序号加入有 1,2,3,7,8,9,10 我想设置一个按钮 , 如果组合框中原来是1,点击后自动变为 2,再点击变 3 之后是 7,8,9,10,1,2,3 我的代码是这样写的 Dim djxh As WinForm.TextBox = Forms("点检窗口").Controls("点检序号") Dim x As String = djxh.Value Dim Products As List(Of String) Products = DataTables("点检序号总表").GetValues("点检序号") For Each Product As String In Products If x <> "" Then x = val(x) + 1 Dim r As DataRow = DataTables("点检序号总表").find("点检序号 = \'" & x & "\'") If r IsNot Nothing Then djxh.Value = x \'ElseIf product > x Then \'djxh.value = product End If End If next 出来之后数全是乱弹,求帮忙改一下
|
-- 作者:Hyphen -- 发布时间:2016/8/27 11:08:00 -- Dim djxh As WinForm.TextBox = Forms("点检窗口").Controls("点检序号") Dim x As String = djxh.Value Dim Products As List(Of String) = DataTables("点检序号总表").GetValues("点检序号") If x > "" Then For i As Integer = 0 To Products.Count - 1 If x = Products(i) Then If i = Products.Count - 1 x = Products(0) Else x = Products(i+1) End If Exit For End If Next End If |
-- 作者:18804248860 -- 发布时间:2016/8/27 11:12:00 -- 感谢老师,帮我把鼓弄了一天的题解决了 |