Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
以下代码是获取项目中有表名称到 ComboBox1下拉列中。
Dim s As string
For Each dt As DataTable In DataTables
s+ = "|" & dt.Name
Next
Forms("窗口1").Controls("ComboBox1").ComboList = s
我想问:如何获取项目中所有表标题名称;由于我用的表名都是英文的,而标题名称是用中文的,所以,有没有办法获取标题名称。
先谢谢了!
CZY老师你好!
窗体中有COMBOBOX1 和 COMBOBOX2
由于表名是使用英文名称,标题是用中文,这是为了方便平时操作者的习惯而制定的,
请先看以下代码:
选择控件ComboBox1时:
e.sender.items.clear
Dim s As String
For Each dt As DataTable In DataTables
s = dt.Caption ‘获取了项目中所有表的标题 --- (如果用 s=dt.name,则是获取项目中所有表名称)
If s <> "" Then
e.sender.items.Add(s)
End If
Next
我现在需要:
选择ComboBox2控件时;能根据ComboBox1所选择的表标题(注意是表的标题),对应加载该表的所有列名称;
这不是问题吧?
你设置ComboBox2的enter事件:
if e.form.Controls("ComboBox1“).Value IsNot Nothing then
Dim dt AS DataTable = DataTables(e.form.Controls("ComboBox1“).Value)
dim s as String
for each dc as datacol in dt.datacols
s = s & "|" & dc.name
next
e.form.Controls("ComboBox2“).Combolist = s
end if
s = s & "|" & dc.Caption ' 列标题
s = s & "|" & dc.name ' 列名称