win编程的一个问题求教:

win程序:要求绑定comboBox后,立刻修改index为0的值;
我下面的代码是曲线救国,有更好的办法吗?   

//comboBox1.DataSource = ItemObject ; 不用绑定方式,用添加的方式,“手工绑定”

   System.Object[] ItemObject = new System.Object[10];
   for (int i = 0; i <= 9; i++)
   {
    ItemObject[i] = "Item" + i;
   }
   comboBox1.Items.AddRange(ItemObject);

   //修改 = 删除 + 新增
   comboBox1.Items.RemoveAt(0);

   comboBox1.Items.Insert(0, "Copenhagen");

posted on 2004-06-03 20:48  小牛哥  阅读(552)  评论(1编辑  收藏  举报

导航