Chinaunix首页 | 论坛 | 博客
  • 博客访问: 362395
  • 博文数量: 94
  • 博客积分: 2500
  • 博客等级: 少校
  • 技术积分: 823
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-04 16:49
文章分类

全部博文(94)

文章存档

2015年(1)

2011年(1)

2010年(3)

2008年(8)

2007年(55)

2006年(26)

我的朋友

分类:

2007-09-23 21:11:37

先说一下共有的属性Items:
ComboBox和ListBox都有一个属性Items,Items是一个集合,通常可以使用ComboBox1.Items[i]来访问起其中某一项,但是这个返回类型一般是object类型,在使用前通常要强制转换为相应的类型,如果是String类型一般可以不用转换。Items中又包含了一些属性和方法,常用的方法为:
Add(object item);AddRange(object[] items);//添加数组
Insert(int index, object item);
IndexOf(object value);
Clear();Remove(object value);RemoveAt(int index);
属性有Count;IsReadOnly;
 
关于ComboBox和ListBox,它们均继承与ListControl,主要说一下与用户选择某项有关的属性和方法:
Select();或Select(int start, int length);
SelectAll();
SelectedIndex;SelectedItem;SelectedText;
SelectionLength;SelectionStart;SelectedValue;
当用户没有选择的时候的,SelectedIndex通常为-1。
阅读(2388) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~