以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  新增明细这段代码错在哪里?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=151592)

--  作者:ZJZK2018
--  发布时间:2020/6/29 0:18:00
--  新增明细这段代码错在哪里?
For Each ct As Object In e.Form.Controls
    If Typeof ct Is WinForm.Table Then
        If ct.Visible = True Then
            Dim nr As Row
            Dim nms() As String = {"Table2","Table3","Table4"}
            For Each nm As String In nms
                If ct.Table.Name.Contains("nm") Then
                    ct.Table.Focus  \'将输入焦点移到指定Table表中
                    nr = ct.Table.AddNew()
                    ct.Table.Select(nr.Index,0)  \'定位到新增行的第一列单元格
                    \'ct.Table.StartEditing   \'进入单元格编辑模式
                End If
            Next
        End If
       
    End If
Next

--  作者:linyunu
--  发布时间:2020/6/29 8:24:00
--  
For Each ct As Object In e.Form.Controls
    If Typeof ct Is WinForm.Table Then
        If ct.Visible = True Then
            Dim tb As WinForm.Table = ct
            Dim nr As Row = tb.Table.AddNew()
            ct.Table.Select(nr.Index,0)  \'定位到新增行的第一列单元格
            ct.Table.StartEditing   \'进入单元格编辑模式
            Exit For
        End If
    End If
Next

--  作者:有点蓝
--  发布时间:2020/6/29 8:54:00
--  
Dim nms() As String = {"Table2","Table3","Table4"}
For Each nm As String In nms
    Dim t As Table = Tables(nm)
    If t.Visible Then
        t.Focus  \'将输入焦点移到指定Table表中
        Dim nr As Row= t.AddNew()
        t.Select(nr.Index,0)  \'定位到新增行的第一列单元格
        \'ct.Table.StartEditing   \'进入单元格编辑模式
exit for
    End If
Next

--  作者:ZJZK2018
--  发布时间:2020/6/29 16:12:00
--  

有点蓝还是不行,点击没有反应


图片点击可在新窗口打开查看此主题相关图片如下:1593418230(1).png
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2020/6/29 16:22:00
--  
几个表是不是都是显示状态?具体上传实例说明
--  作者:ZJZK2018
--  发布时间:2020/6/29 16:24:00
--  
例子
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目2.foxdb


--  作者:有点蓝
--  发布时间:2020/6/29 16:34:00
--  
使用控件来判断

Dim nms() As String = {"Table2","Table3","Table4"}
For Each nm As String In nms
    Dim t As WinForm.Table = e.Form.Controls(nm)
    If t.Visible Then
        t.Table.Focus  \'将输入焦点移到指定Table表中
        Dim nr As Row= t.Table.AddNew()
        t.Table.Select(nr.Index,0)  \'定位到新增行的第一列单元格
        \'ct.Table.StartEditing   \'进入单元格编辑模式
        Exit For
    End If
Next