以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  DropDownForm  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=173648)

--  作者:水墨青花
--  发布时间:2021/12/9 19:38:00
--  DropDownForm
老师,

DropDownForm 打开后,如果没有选择任何行,总是自动默认选择第一行。
请问如何解决这个问题?


\'#DropDownOpened()

Dim txt As String = e.Form.DropDownBox.Text
Dim tbl As Table = Tables("样品筛选_Table1")
If txt = "" Then
    tbl.Filter = ""
Else
    txt = "\'%" & txt & "%\'"
    tbl.Filter = "名称 Like " & txt
End If
tbl.Sort = "项目,小类,名称,批号,入库日期 Desc"

e.Form.DropDownBox.Select()


\'#DropdownClosed()

If e.Selected Then \'如果选择了值
    Dim tbl As Table = Tables("样品筛选_Table1")
    If tbl.Current IsNot Nothing Then
        e.Form.DropDownBox.Value = tbl.Current("名称")
        Tables("实验记录_Table3").Current("厂家") = tbl.Current("厂家")
        Tables("实验记录_Table3").Current("批号") = tbl.Current("批号")
        Tables("实验记录_Table3").Current("规格") = tbl.Current("规格")
        
        If e.Form.DropTable IsNot Nothing Then \'如果是通过表下拉的
            e.Form.DropTable.FinishEditing()
        Else \'如果是通过窗口下拉的
            e.Form.DropDownBox.WriteValue()
        End If
    End If
End If

--  作者:有点蓝
--  发布时间:2021/12/9 20:24:00
--  
参考:http://www.foxtable.com/webhelp/topics/2461.htm,添加取消按钮