菜单有一个列表项目,希望能自动获取内容,测试代码如下
Dim cmd As SQLCommand
cmd.C
Dim dt As DataTable
cmd.CommandText = "SELECT DISTINCT 区域 From {客户资料}"
dt = cmd.ExecuteReader()
Dim cmb As RibbonMenu.ComboBox = RibbonTabs("内容查询").Groups("精确查询").Items("辖区查询")
Dim vals() As String = dt.GetComboListString("区域").Split("|")
With RibbonTabs("内容查询").Groups("精确查询").Items("辖区查询")
.Items.Clear
For Each val As String In vals
Dim btn As new RibbonMenu.Button(val)
btn.text = val
cmb.Items.Add(btn)
Next
.Text= Vals(0)
End With
提示:System.NullReferenceException:未将对象引用设置到对象的实例,
已解决:问题是
Dim cmd As New SQLCommand 少了3字母
[此贴子已经被作者于2014-4-29 10:03:09编辑过]