以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]搜索控件时,text属性搜不到:请教  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=60949)

--  作者:ljh29206
--  发布时间:2014/12/4 12:03:00
--  [求助]搜索控件时,text属性搜不到:请教

Dim dt As Table = Tables("出货基础信息表")
           For Each c As WinForm.Control In Forms("窗口3").Controls
               If Typeof c Is WinForm.button Then \'判断控件是否是文本框
                    If c.text Like   " \'" & dt.Rows(1)("客户") & dt.Rows(1)("便次") & "\'*"
                          Output.Show(c.name)
                      c.text = dt.Rows(1)("客户") & dt.Rows(1)("便次") & "订单处理完成"
                      c.BackColor = Color.Crimson
                Else
            Output.Show(c.name)
                End If
    End If
             Next

 

问下, 为什么 botton  在动态添加控件的时候可以设置 text 文本

 

但上边的代码却报错? 提示 text 不是 BUTTON 的成员?


--  作者:czy
--  发布时间:2014/12/4 12:20:00
--  
这样试试

Dim dt As Table = Tables("出货基础信息表")
For Each c As WinForm.Control In Forms("窗口3").Controls
    If Typeof c Is WinForm.button Then 
        Dim b As WinForm.button = c
        If b.text Like   " \'" & dt.Rows(1)("客户") & dt.Rows(1)("便次") & "\'*"
            Output.Show(b.name)
            b.text = dt.Rows(1)("客户") & dt.Rows(1)("便次") & "订单处理完成"
            b.BackColor = Color.Crimson
        Else
            Output.Show(b.name)
        End If
    End If
Next

--  作者:程兴刚
--  发布时间:2014/12/4 12:22:00
--  
别的原因吧!
--  作者:ljh29206
--  发布时间:2014/12/4 13:27:00
--  
可以了 谢谢。