以文本方式查看主题

-  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=29997)

--  作者:hanxuntx
--  发布时间:2013/3/18 20:49:00
--  关于判断副本表的疑问
 

Dim s As String
Dim
t As Table = Tables("窗口1_Table1")
Select
Case t.TableType
Case
TableTypeEnum.Normal
If
t.IsCopy
Then
s =
"副本"
Else
s =
"标准"
End If
Case TableTypeEnum.SQLTable
s =
"SQLTable"
Case TableTypeEnum.SQLQuery
s =
"SQLQuery"
End
Select
MessageBox.Show(s)

 

上面这段代码首先要知道 表的名字 Tables("窗口1_Table1") 但是如果已经知道表的名字是这样了,也就知道是不是副本了。

 

现在的问题是 窗口中有几个表 有副本 有非副本

遍历所有表控件

能不能直接从控件 判断其是不是副本?


--  作者:czy
--  发布时间:2013/3/18 22:21:00
--  

先判断控件类型再判断吧。

不过,如果是非副本好像会出错的。


--  作者:hanxuntx
--  发布时间:2013/3/18 22:24:00
--  
C版 即使知道了控件类型是Table 但是怎么知道这个Table的类型呢?怎么知道这个Table绑定的是不是副本呢?
--  作者:czy
--  发布时间:2013/3/18 22:32:00
--  

如果是非副本会出错,这个我搞不定它。

 

For Each c As WinForm.Control In e.Form.Controls
    try
        If c.Gettype.name = "Table"
            Dim s As String
            Dim t As Table = Tables(e.Form.Name & "_" & c.name)
            Select Case t.TableType
                Case TableTypeEnum.Normal
                    If t.IsCopy Then
                        s = "副本"
                    Else
                        s = "标准"
                    End If
                    MessageBox.Show(s)
            End Select
        End If
    Catch ex As Exception
    End try
Next


--  作者:hanxuntx
--  发布时间:2013/3/19 12:49:00
--  

嗯 因为您是假设表都是副本的。

顶顶


--  作者:狐狸爸爸
--  发布时间:2013/3/19 12:52:00
--  

这么修改一下C版的代码

 

For Each c As WinForm.Control In e.Form.Controls
    If c.Gettype.name = "Table"
        Dim s As String
        Dim t As Table = ctype(c,Winform.Table).Table
        Select Case t.TableType
            Case TableTypeEnum.Normal
                If t.IsCopy Then
                    s = "副本"
                Else
                    s = "标准"
                End If
                MessageBox.Show(s)
        End Select
    End If
Next


--  作者:hanxuntx
--  发布时间:2013/3/19 13:16:00
--  
谢谢c版 和狐爸