以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 菜单ComboBox应该如何用代码设定列表项目? 相同方法窗口ComboBox却可以的 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=82894) |
-- 作者:四月清风 -- 发布时间:2016/3/27 8:00:00 -- 菜单ComboBox应该如何用代码设定列表项目? 相同方法窗口ComboBox却可以的 窗口ComboBox可以正常设定为 列1 列2 列3 列4 但是菜单ComboBox却设定为: 列1|列2|列3|列4 以下代码应该如何修改,谢谢! Dim cmb As WinForm.ComboBox cmb = Forms("窗口1").Controls("list") \' 这个是窗口ComboBox, 正常设定 cmb.AllowEditValue=False Dim f As String For Each c As Col In Tables(e.Form.TableName).Cols If f ="" Then f=c.Name Else f=f & "|" & c.Name End If Next cmb.ComboList = f cmb.SelectedIndex=0 \'------------------------------ \'以下是菜单ComboBox,列表无法正常设定 Dim cmb As RibbonMenu.ComboBox = RibbonTabs("功能区1").Groups("功能组1").Items("list") Dim f As String For Each c As Col In Tables(CurrentTable.name).Cols If f ="" Then f=c.Name Else f=f & "|" & c.Name End If Next cmb.Text = f |
-- 作者:Hyphen -- 发布时间:2016/3/27 11:04:00 -- Dim cmb As RibbonMenu.ComboBox = RibbonTabs("功能区1").Groups("功能组1").Items("list") For Each c As Col In Tables(CurrentTable.name).Cols Dim b As New RibbonMenu.Button(c.Name) \'定义一个标准按钮 b.Text= c.Name cmb.Items.add(b) Next |