下拉窗口是这样的
此主题相关图片如下:123.png

AfterLoad
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree("客户档案","客户分属|客户名称")
NodeMouseClick
If e.Node.Level = 1 Then
Dim tr As Row = Tables("客户档案").Current
Dim dr As DataRow = e.Node.DataRow
tr("客户分属") = dr("客户分属")
tr("客户名称") = dr("客户名称")
e.Form.DropDownBox.Value = tr("客户名称")
e.Form.DropDownBox.CloseDropdown()
End If
下一个按钮
Dim txt As String = e.Form.DropDownBox.Text
If txt = "" Then
Return
End If
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim Start As Integer
Dim idx As Integer = - 1
If trv.SelectedNode IsNot Nothing Then
Dim FullName As String = trv.SelectedNode.FullName
For i As Integer = 0 To trv.AllNodes.count - 1
If trv.AllNodes(i).FullName = FullName Then
Start = i
Exit For
End If
Next
End If
For i As Integer = Start + 1 To trv.AllNodes.count - 1
Dim nd As WinForm.TreeNode = trv.AllNodes(i)
If nd.Text.IndexOf(txt) >= 0 Then
trv.SelectedNode = nd
nd.EnsureVisible
idx = i
Exit For
End If
Next
If idx = -1 Then
For i As Integer = 0 To Start - 1
Dim nd As WinForm.TreeNode = trv.AllNodes(i)
If nd.Text.IndexOf(txt) >= 0 Then
trv.SelectedNode = nd
nd.EnsureVisible
Exit For
End If
Next
End If
trv.Select()
确定按钮
Dim s As String = ""
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each nd As WinForm.TreeNode In trv.ALLNodes
If nd.nodes.count = 0 AndAlso nd.Checked Then
s = s & "," & nd.Text
End If
Next
e.Form.DropDownBox.Value = s.trim(",")
e.Form.DropDownBox.CloseDropdown
然后在一个录入窗口中绑定了这个下拉窗口

此主题相关图片如下:321.png

但经常会出现这样的情况,就是录入窗口的下拉框中选择了客户名称后,会改变客户档案中的某一行的客户名称,是光标所在行,默认第一行,一直找不出原因

此主题相关图片如下:333.png

[此贴子已经被作者于2021/10/25 15:39:21编辑过]