以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 复制当前行数据代码出错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=119807) |
-- 作者:ZJZK2018 -- 发布时间:2018/6/1 10:55:00 -- 复制当前行数据代码出错 老师你好: 复制当前行数据代码出错,我的需求是:打开副表时,自动增加4行,并把当前行的相关数据复制到新增这个4行中。 下面这段代码如何修改: Dim tp As WinForm.TabControl = e.sender Select Case tp.SelectedPage.Text Case "批量录入" If Tables("原材料").Rows.Count = 0 Then \'如果是一个空表 Return \'那么返回 End If Dim idxs As String = "-1," Dim dr As Row = Tables("原材料").Current For Each dc As Col In Tables("原材料").Cols For i As Integer = 1 To 4 Dim nr As Row = Tables("原材料进场录入_Table1").AddNew idxs & = nr("_Identify") & "," nr(i) = dr(dc.Name) Next Next Tables("原材料进场录入_Table1").filter = "_Identify in (" & idxs.Trim(",") & ")" End Select |
-- 作者:有点甜 -- 发布时间:2018/6/1 11:17:00 -- 改成
Dim tp As WinForm.TabControl = e.sender |
-- 作者:ZJZK2018 -- 发布时间:2018/6/1 11:30:00 -- 老师还是不对: |
-- 作者:有点甜 -- 发布时间:2018/6/1 11:37:00 -- Dim tp As WinForm.TabControl = e.sender Select Case tp.SelectedPage.Text Case "批量录入" If Tables("原材料").Rows.Count = 0 Then \'如果是一个空表 Return \'那么返回 End If Dim idxs As String = "-1," Dim dr As Row = Tables("原材料").Current For i As Integer = 1 To 4 Dim nr As Row = Tables("原材料进场录入_Table1").AddNew idxs & = nr("_Identify") & "," For Each dc As Col In Tables("原材料").Cols nr(dc.name) = dr(dc.Name) Next Next Tables("原材料进场录入_Table1").filter = "_Identify in (" & idxs.Trim(",") & ")" End Select |
-- 作者:ZJZK2018 -- 发布时间:2018/6/1 12:25:00 -- 有点甜老师你好: 我还有个需求:如果当前行为新增行时,如何同时增加到“原材料进场录入_Table1”表中,如果当前行不为新增行时,就不能增加到“原材料进场录入_Table1”表中 Dim tp As WinForm.TabControl = e.sender Select Case tp.SelectedPage.Text Case "批量录入" If Tables("原材料").Rows.Count = 0 Then \'如果是一个空表 Return \'那么返回 End If Dim idxs As String = "-1," Dim dr As DataRow = Tables("原材料").Current.DataRow If dr.RowState = DataRowState.Detached Then Tables("原材料进场录入_Table1").filter = "dr.RowState = DataRowState.Detached " End If For i As Integer = 1 To 4 Dim nr As Row = Tables("原材料进场录入_Table1").AddNew idxs & = nr("_Identify") & "," For Each dc As Col In Tables("原材料").Cols nr(dc.name) = dr(dc.Name) Next Next Tables("原材料进场录入_Table1").filter = "_Identify in (" & idxs.Trim(",") & ")" End Select |
-- 作者:有点甜 -- 发布时间:2018/6/1 15:04:00 -- 这个意思
Dim tp As WinForm.TabControl = e.sender |