如何通过从组合框传递值来获取索引 [英] how to get the index by passing value from a combobox
本文介绍了如何通过从组合框传递值来获取索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello Experts,
我想得到组合框的索引值,其值为参数。
Foe示例
我的组合框有
消费者
Commerial
Cosumer OPP
现在如果我通过消费者,我应该是那个combox的索引。
可能有人请帮帮我。非常重要
Hello Experts,
I want to get the index value of combobox with the value as parameter.
Foe Example
My Combobox has
consumer
Commerial
Cosumer OPP
Now If I pass Consumer , I should the index of that combox.
Could someone help me please. Very important
推荐答案
您使用方法ComboBox.Items.IndexOf
。您将遇到的问题是集合中的对象如何比较自己。如果您没有覆盖自定义对象上的Equals
方法,则默认操作只会比较引用而不是对象属性的值。
ComboBox.ObjectCollection.IndexOf [ ^ ]
You use the the methodComboBox.Items.IndexOf
. The issue you will run into is how the objects in the collection compare themselves. If you do not override theEquals
method on your custom objects, the default operation will simply compare references and not the values of the object properties.
ComboBox.ObjectCollection.IndexOf[^]
这篇关于如何通过从组合框传递值来获取索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文