Foxtable(狐表)用户栏目专家坐堂 → 这段通用代码有什么问题


  共有15962人关注过本帖平板打印复制链接

主题:这段通用代码有什么问题

帅哥哟,离线,有人找我吗?
blackzhu
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57590 威望:0 精华:15 注册:2008/9/1 9:45:00
这段通用代码有什么问题  发帖心情 Post By:2011/12/2 8:53:00 [只看该作者]

 

   是这样,我的表单有的有表控件,有的没有.


   原来这段代码我是遍历控件,判断table1控件是否存在?代码如下:

   If e.Sender.Text = "保存单据" Then
    If Tables(e.form.Name).Rows.Count>0 Then
        Tables(e.form.Name).Current("修改人") = _UserName
        Tables(e.form.Name).Current("修改时间") = Date.Now()
        Tables(e.form.Name).DataTable.Save()
    End If
    For Each c As Winform.Control In e.Form.Controls
        If Typeof c Is WinForm.Table Then
            If e.form.ExistControl("Table1") =True Then
                If DataTables(e.form.Name & "_Table1").DataRows.Count>0 Then
                    DataTables(e.form.Name & "_Table1").Save
                End If
                Dim t As Table = Tables(e.form.Name & "_Table1")
                With Tables(e.form.Name)
                    If .Current Is Nothing Then
                        t.Filter = "False"
                    Else
                        t.Filter = "系统单号 = '" & .Current("系统单号") & "'"
                    End If
                End With
            End If
        End If
    Next
End If
  但是提示,找不到Table1的控件.后来改成这样:

If e.Sender.Text = "保存单据" Then
    If Tables(e.form.Name).Rows.Count>0 Then
        Tables(e.form.Name).Current("修改人") = _UserName
        Tables(e.form.Name).Current("修改时间") = Date.Now()
        Tables(e.form.Name).DataTable.Save()
        If e.form.ExistControl(e.form.Name & "_Table1") =True Then
            If DataTables(e.form.Name & "_Table1").DataRows.Count>0 Then
                DataTables(e.form.Name & "_Table1").Save
            End If
            Dim t As Table = Tables(e.form.Name & "_Table1")
            With Tables(e.form.Name)
                If .Current Is Nothing Then
                    t.Filter = "False"
                Else
                    t.Filter = "系统单号 = '" & .Current("系统单号") & "'"
                End If
            End With
        End If
    End If
End If
  这样是不提示了,但是窗口表不保存,是什么问题?

 


 回到顶部
总数 32 1 2 3 4 下一页