VB 看看有什么方法简化,不使用数组
Combo1.Text = ""
Combo1.AddItem "高压电器"
Combo1.AddItem "低压电器"
Combo1.AddItem "给排水系统"
Combo1.AddItem "空调、暖通"
Combo1.AddItem "消防系统"
Combo1.AddItem "安防系统"
Combo1.AddItem "弱电"
Combo1.AddItem "其它"
Combo1.AddItem "集合"
Combo3.Text = ""
Combo3.AddItem "高压电器"
Combo3.AddItem "低压电器"
Combo3.AddItem "给排水系统"
Combo3.AddItem "空调、暖通"
Combo3.AddItem "消防系统"
Combo3.AddItem "安防系统"
Combo3.AddItem "弱电"
Combo3.AddItem "其它"
Combo3.AddItem "集合"
Combo5.Text = ""
Combo5.AddItem "高压电器"
Combo5.AddItem "低压电器"
Combo5.AddItem "给排水系统"
Combo5.AddItem "空调、暖通"
Combo5.AddItem "消防系统"
Combo5.AddItem "安防系统"
Combo5.AddItem "弱电"
Combo5.AddItem "其它"
Combo5.AddItem "集合"
Combo7.Text = ""
Combo7.AddItem "高压电器"
Combo7.AddItem "低压电器"
Combo7.AddItem "给排水系统"
Combo7.AddItem "空调、暖通"
Combo7.AddItem "消防系统"
Combo7.AddItem "安防系统"
Combo7.AddItem "弱电"
Combo7.AddItem "其它"
Combo7.AddItem "集合"
Combo9.Text = ""
Combo9.AddItem "高压电器"
Combo9.AddItem "低压电器"
Combo9.AddItem "给排水系统"
Combo9.AddItem "空调、暖通"
Combo9.AddItem "消防系统"
Combo9.AddItem "安防系统"
Combo9.AddItem "弱电"
Combo9.AddItem "其它"
Combo9.AddItem "集合"
Combo11.Text = ""
Combo11.AddItem "高压电器"
Combo11.AddItem "低压电器"
Combo11.AddItem "给排水系统"
Combo11.AddItem "空调、暖通"
Combo11.AddItem "消防系统"
Combo11.AddItem "安防系统"
Combo11.AddItem "弱电"
Combo11.AddItem "其它"
Combo11.AddItem "集合"
Combo13.Text = ""
Combo13.AddItem "高压电器"
Combo13.AddItem "低压电器"
Combo13.AddItem "给排水系统"
Combo13.AddItem "空调、暖通"
Combo13.AddItem "消防系统"
Combo13.AddItem "安防系统"
Combo13.AddItem "弱电"
Combo13.AddItem "其它"
Combo13.AddItem "集合"
Combo15.Text = ""
Combo15.AddItem "高压电器"
Combo15.AddItem "低压电器"
Combo15.AddItem "给排水系统"
Combo15.AddItem "空调、暖通"
Combo15.AddItem "消防系统"
Combo15.AddItem "安防系统"
Combo15.AddItem "弱电"
Combo15.AddItem "其它"
Combo15.AddItem "集合"
Combo17.Text = ""
Combo17.AddItem "高压电器"
Combo17.AddItem "低压电器"
Combo17.AddItem "给排水系统"
Combo17.AddItem "空调、暖通"
Combo17.AddItem "消防系统"
Combo17.AddItem "安防系统"
Combo17.AddItem "弱电"
Combo17.AddItem "其它"
Combo17.AddItem "集合"
Combo19.Text = ""
Combo19.AddItem "高压电器"
Combo19.AddItem "低压电器"
Combo19.AddItem "给排水系统"
Combo19.AddItem "空调、暖通"
Combo19.AddItem "消防系统"
Combo19.AddItem "安防系统"
Combo19.AddItem "弱电"
Combo19.AddItem "其它"
Combo19.AddItem "集合"
[解决办法]
Dim obj As ObjectFor Each obj In Controls If Left(obj.Name, 5) = "Combo" Then obj.Text = "" obj.AddItem "高压电器" obj.AddItem "低压电器" obj.AddItem "给排水系统" obj.AddItem "空调、暖通" obj.AddItem "消防系统" obj.AddItem "安防系统" obj.AddItem "弱电" obj.AddItem "其它" obj.AddItem "集合" End IfNext