以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  如何编程改变控件的名称  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141966)

--  作者:mxl810823
--  发布时间:2019/10/15 12:02:00
--  如何编程改变控件的名称
执行如下程序,T的name并没有被改变,为什么?如何改变控件的名称?
For Each c As WinForm.Control In e.form.controls
    If Typeof c Is WinForm.TextBox Then
        Dim t As WinForm.TextBox = c
        If t.name = "TextBox8" Then
            t.name = "123456"
        End If
    End If
Next

--  作者:有点蓝
--  发布时间:2019/10/15 12:05:00
--  
应该是改变标题吧,不建议改控件名称。

使用代码改的,在窗口设计器是看不出的。

For Each c As WinForm.Control In e.form.controls
output.show(c.name)
    If Typeof c Is WinForm.TextBox Then
        Dim t As WinForm.TextBox = c
        If t.name = "TextBox8" Then
            t.name = "123456"
        End If
    End If
Next
output.show(e.form.ExistControl("TextBox8"))
output.show(e.form.ExistControl("123456"))

--  作者:mxl810823
--  发布时间:2019/10/15 12:13:00
--  
我想改窗体中所有控件的名称,一个个改麻烦,我想编程一次改过来。如何改???


--  作者:有点蓝
--  发布时间:2019/10/15 13:36:00
--  
没有办法,只能一个个改