以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  如果窗口表有下一行,就选择他,如果没有就选择当前行,请问怎么改代码,谢谢  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=85870)

--  作者:taoxian
--  发布时间:2016/6/4 9:52:00
--  如果窗口表有下一行,就选择他,如果没有就选择当前行,请问怎么改代码,谢谢
Dim cr As Row = Tables("窗口1_Table1").current
If cr IsNot Nothing Then
    Dim dr As Row = Tables("窗口1_Table1").Rows(iif(cr.index=0, 0, cr.index-1))
    Dim txt1 As String = dr("第三列")
    Dim t As Table = Tables("窗口2_Table1")
    For i As Integer = 0 To t.Rows.Count -1
        If t.Rows(i)("第三列") = txt1 Then
            t.Position = i
            Exit For
        End If
    Next
End If

这个是找到 窗口1的上一行 然后在 窗口2中 第三列找到并选定它  

现在想写为 如果 有下一行  就选择 窗口2的下一行 

请问怎么加代码!!!!!!!!谢谢

--  作者:Hyphen
--  发布时间:2016/6/4 11:08:00
--  
Dim cr As Row = Tables("窗口1_Table1").current
If cr IsNot Nothing Then
    Dim dr As Row = Tables("窗口1_Table1").Rows(iif(cr.index=0, 0, cr.index-1))
    Dim txt1 As String = dr("第三列")
    Dim r As Integer = Tables("窗口2_Table1").Find(txt1,0,"第三列",False,True,False)
    If r > - 1 Then \'如果找到符合条件的行
        Tables("窗口2_Table1").Position = r+1 \'则选择该行
    End If
End If