selectedindex是什么意思,c# combobox .SelectedIndex属性是什么来的
selectedindex是什么意思,c# combobox .SelectedIndex属性是什么来的详细介绍
本文目录一览: selectedIndex有什么用?
selectedIndex是返回下拉列表中被选选项的索引号。
selectedIndex代表的是你所选中项的index。
c#中selectedindex != -1什么意思
selectedindex 这是变量名,英文意思是选定的索引指数。
!= -1 不等于 负一。
若放在条件语句里 就是 如果 选定的索引指数 不等于 -1, 则 如何如何,否则 如何如何。
C# 中 listBox1.SelectedIndex!= -1什么意思啊?不明白这个-1
listBox1.SelectedIndex!= -1
选中的LISTBOX都会有一个INDEX如果等于-1就代表他没有选择一项...
表示默认的吧,如将
这里是表示什么也没有选中,如果选中的话selectedindex就是选中的index,就是序号数字1,2,3...等,你可以在selectindexchanging事件中测试一下,response.write(listBox.selectedindex)下,看看就知道了
下面这段代码中的$('city').selectedIndex是什么意思?
获取下拉框中选择的那个的索引
如果你没写错,city是页面中的一个标签
,获取
标签选择索引
OnSelectedIndexChanging是什么意思
是分什么控件,如果是下拉列表控件表示选择的下拉列表项改变了触发该事件
就是聚焦索引改变的意思
举个例子:有两个TextBox控件,其中一个的TabIndext是0,另一个的TabIndet是1,
现在聚焦在第一个TextBox控件,当你聚焦到另一个TextBox控件的时候
就会触发这个OnSelectedIndexChanging事件
c# combobox .SelectedIndex属性是什么来的
您好,这样的:
datatable
table
=
(datatable)combobox1
.datasource;
//把数据源赋给table
datarow
dr
=
table.newrow();
dr[0]
=
"0";
dr[1]
=
"---请选择---";
table.rows.insertat(dr,
0);
combobox1.datasource
=
table;
//combobox1
的数据源为table
combobox1.selectedindex
=
0;
//默认显示"请选择"
这个属性是控件自己控制的。。。从0开始的。。属性那里可能是找不到的。。不能为它赋值 只能取值。。你可以找到SelectedText和Value吧 一样的散
cs文件裏面使用吧,设置你当前选择的项。
C#很多属性都在属性栏里面找不到
这个属性是需要在程序里面写的
.NET Framework 类库ComboBox.SelectedIndex 属性获取或设置指定当前选定项的索引。
命名空间:System.Windows.Forms
程序集:System.Windows.Forms(在 system.windows.forms.dll 中)
语法
Visual Basic(声明) Public Overrides Property SelectedIndex As Integer
Visual Basic(用法) Dim instance As ComboBox
Dim value As Integer
value = instance.SelectedIndex
instance.SelectedIndex = value
C# public override int SelectedIndex { get; set; }
C++ public:
virtual property int SelectedIndex {
int get () override;
void set (int value) override;
}
J# /** @property */
public int get_SelectedIndex ()
/** @property */
public void set_SelectedIndex (int value)
JScript public override function get SelectedIndex () : int
public override function set SelectedIndex (value : int)
属性值
当前选定项的从零开始的索引。如果未选定任何项,则返回值为负一 (-1)。
异常
异常类型 条件
ArgumentOutOfRangeException
指定的索引小于或等于 -2。
- 或 -
指定的索引大于或等于组合框中的项数。
备注
该属性指示组合框列表中当前选定项从零开始的索引。设置新的索引将引发 SelectedIndexChanged 事件。
SelectedIndex、 SelectedValue 及 FormattingEnabled 的关系如下:
如果 FormattingEnabled 为 false,则当 SelectedValue 为空时,SelectedIndex 不会被设置为 -1。
如果 FormattingEnabled 为 true,则当 SelectedValue 为空时,SelectedIndex 将被设置为 -1。
注意
若要取消选择当前选定项,请将 SelectedIndex 设置为 -1。如果 ComboBox 项是数据绑定项,则不能将该项的 SelectedIndex 设置为 -1。
JAVA中getSelectedIndex()是什么作用
int getSelectedIndex()
Gets the index of the selected item on the list, //得到选中条目的号呀
没事多看看API 很好
得到链表中所选项目的索引
没有一个项目被选中就返回-1
jdk文档里如下说:
public int getSelectedIndex()
Gets the index of the selected item on the list,
Returns:
the index of the selected item; if no item is selected, or if multiple items are selected, -1 is returned.
See Also:
select(int), deselect(int), isIndexSelected(int)
问一个C#的小问题
在窗体的构造函数里填下面一句代码:
comboBox1.SelectedItem = "字符串";
那个“字符串”的内容要和你给combox里的item添加的项其中之一的内容一样,而且就是你希望要默认显示的那个项
两种方法:在combox绑定数据后窗体加载时用:
combox.SelectedIndex=默认项的索引(从0开始);
或combox.SelectedValue=“默认项名称”;
可以在窗体的加载事件中用 comboBox1.SelectedIndex 来设置你要默认选择的项,还有几个属性也可以用来设置默认选定项,都是以Selected开头的,你可以看看。
用comboBox1.SelectedIndex 设定就可以了啊,比如comboBox1.SelectedIndex =-1就是什么都不选
comboBox1.SelectedIndex = 0;就是选中第一项
不过注意一点就是索引不要越界,也就是你只有5个元素就不要comboBox1.SelectedIndex =5(0是第一个,5就是第6个了,越界了)
vb中这句话是什么意思?Grid.TextMatrix(selectedIndex, 4) = txt_num.Text
把变量txt_num.text的值赋给GRID控件的第selectedindex行第4列
这里txt_num.txt和selectedindex都是变量 如果报错 你要注意下selectedindex的值的范围看对不对 因为控件grid的行参数是有要求的
将文本框txt_num中的文本.Text赋给表格控件Grid的第selectedIndex行第 4列
地方
DFSDAFSD