以文本方式查看主题

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

--  作者:wumingrong1
--  发布时间:2014/8/26 12:23:00
--  [求助] 控件的输入助手问题
我有一个ComboBox控件,在该控件的Enter中写入以下命令,即可实现其列表项目来自于 机房列表 的 机房名称;同时我还启动了该控件的“启用输入助手”功能。

Dim flt As String
e.Sender.ComboList = DataTables("机房列表").GetComboListString("机房名称",flt)

如果我想实现:我一定要求该
ComboBox 控件所绑定的列所填入的内容必须为来自 机房列表 中的 机房名称 列的内容、如果不是就不允许输入并弹出提示;我该怎么做?
--  作者:lsy
--  发布时间:2014/8/26 12:39:00
--  

Enter
e.Sender.ComboList = DataTables("订单").GetComboListString("产品","产品 Is Not Null")

 

Validating
If e.Sender.Items.Contains(e.Sender.Text) = False Then
    e.Cancel = True
End If


--  作者:wumingrong1
--  发布时间:2014/8/27 11:26:00
--  


我把Validating改为以下命令:
If e.Sender.Items.Contains(e.Sender.Text) = False Then
e.Form.Controls("设备编号").Value = Nothing
MessageBox.Show("请在【设备编号】中输入规范内容", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
End If

可是如果我前面录入了错误的内容;执行该命令后、 设备编号 为空啦、这个时候离开控件还是会弹出提示。我如何设置命令确保不会第二次弹出提示呢?


IF “设备编码”内容不为空 Then
If e.Sender.Items.Contains(e.Sender.Text) = False Then
e.Form.Controls("设备编号").Value = Nothing
MessageBox.Show("请在【设备编号】中输入规范内容", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
End If
End If
[此贴子已经被作者于2014-8-27 11:31:16编辑过]

--  作者:有点甜
--  发布时间:2014/8/27 11:37:00
--  
If e.sender.Text > "" AndAlso e.Sender.Items.Contains(e.Sender.Text) = False Then
    e.Form.Controls("设备编号").Value = Nothing
    MessageBox.Show("请在【设备编号】中输入规范内容", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
End If