完成listbox里项目的添加、删除的关键代码:
1.通过AddRange方法添加项目:this.lbyx.Items.AddRange(new object[] {"北京","上海","天津","成都","广州","深圳","武汉"});
2.添加items:this.lbbx.Items.Add(this.lbyx.Text);
3.清空列表内的所有items:this.lbbx.Items.Clear();
4.当前所选项的编号获取:this.lbbx.SelectedIndex
5.删除某项:this.lbbx.Items.RemoveAt(this.lbbx.SelectedIndex);