以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  下拉窗口问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=153923)

--  作者:wh420
--  发布时间:2020/8/27 17:43:00
--  下拉窗口问题
下拉窗口的afterload事件为:
Dim Products As List(Of String)
Products = DataTables("Table_JieSuan").SQLGetValues("ShouKuanTitle")
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.StopRedraw() \'暂停绘制
lvw.View = ViewMode.SmallIcon \'显示模式为小图标
For Each Product As String In Products
    \'Dim Key As String = dr("图标")
    Dim r As  WinForm.ListViewRow =  lvw.Rows.Add() \'增加一行
    lvw.Images.AddSmallImage("Man", "Man48.ico") \'添加代表这个国家的小图标
    r.ImageKey = "Man" \'指定图标键值
    r.Text = product
    r.Tag = Products \'将对应的Datarow赋值给tag属性,方便在其他事件中调用
Next
lvw.ResumeRedraw() \'恢复绘制


listview1控件的RowActivate事件中的代码应该如何写能实现双击某条记录自动填充其他字段值。(下面代码报错:可能跟TAG属性有关)

Dim lvw As WinForm.ListView = e.Sender
Dim dr As DataRow =  lvw.Current.tag
Dim r As Row = e.Form.DropTable.Current
r("YiYuanName") = dr("YiYuanName")

e.Form.DropDownBox.Value = dr("ShouKuanTitle")
e.Form.DropDownBox.CloseDropdown()



--  作者:有点蓝
--  发布时间:2020/8/27 20:04:00
--  
 加上必要的判断

Dim lvw As WinForm.ListView = e.Sender
if lvw.Current is nothing then return
Dim dr As DataRow =  lvw.Current.tag
……