以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [原创]窗口控件锁定  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=130345)

--  作者:YDS
--  发布时间:2019/1/19 15:08:00
--  [原创]窗口控件锁定
窗口ComboBox2控件的ValueChanged事件代码

If e.sender.value > "" Then
    If Functions.Execute("Get",33).Contains(e.sender.value ) Then
        e.Form.Controls("ComboBox2").Enabled = False
        e.Form.Controls("ComboBox15").Enabled = False
    Else
        e.Form.Controls("ComboBox2").Enabled = True
        e.Form.Controls("ComboBox15").Enabled = True
    End If
End If

为什么ComboBox2控件满足if条件以后自身不会设置成不可用?需要怎么操作?

--  作者:有点蓝
--  发布时间:2019/1/19 15:34:00
--  
改为使用readonly

If e.sender.value > "" Then
    If e.sender.value = "123" Then
        e.sender.ReadOnly = BooleanEnum.True
    Else
        e.sender.ReadOnly = BooleanEnum.Default
    End If
End If

或者

textchanged事件
If e.sender.text > "" Then
    If e.sender.text = "123" Then
        Sendkeys.Send("{TAB}")
    End If
End If
leave事件
If e.sender.text > "" Then
    If e.sender.text = "123" Then
        e.sender.Enabled = False
        e.sender.text = "123" 
    End If
End If

--  作者:YDS
--  发布时间:2019/1/19 17:04:00
--  
为什么会是这样的呢?
--  作者:有点蓝
--  发布时间:2019/1/19 17:21:00
--  
不支持在这些事件设置自己为不可用