以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]条件动态增加控件的困惑 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=132218) |
-- 作者:sunion -- 发布时间:2019/3/17 10:10:00 -- [求助]条件动态增加控件的困惑 以下代码且动态增加控件,控件内容显示为“信息表”中列“评价内容”。 现在的问题是,如果我要按照“姓名”combobox的值,将动态增加控件的内容进行条件显示:满足所有“姓名”列等于“姓名”combobox的值才显示。请问下面代码在哪里添加条件呢? For i As Integer=0 To Tables("信息表").rows.count-1 Dim txt As WinForm.label txt = e.Form.CreateControl("label" & i, ControlTypeEnum.label) txt.text = Tables("信息表").rows(i)("评价内容") txt.Left = 100 txt.Top = 48*i + 50 txt.autosize = True e.Form.AddControl(txt) Next
|
-- 作者:有点蓝 -- 发布时间:2019/3/18 9:14:00 -- 1、 For i As Integer=0 To Tables("信息表").rows.count-1 if Tables("信息表").rows(i)("姓名") = e.form.controls("combobox").text Dim txt As WinForm.label txt = e.Form.CreateControl("label" & i, ControlTypeEnum.label) txt.text = Tables("信息表").rows(i)("评价内容") txt.Left = 100 txt.Top = 48*i + 50 txt.autosize = True e.Form.AddControl(txt) end if Next 2、 For Each dr As DataRow In DataTables("信息表").Select("姓名=\'" & e.form.controls("combobox").text & "\'") Dim txt As WinForm.label txt = e.Form.CreateControl("label" & i, ControlTypeEnum.label) txt.text = dr("评价内容") txt.Left = 100 txt.Top = 48*i + 50 txt.autosize = True e.Form.AddControl(txt) Next |