gpt4 book ai didi

c# - 如何在 C# 的组合框中按值查找项目?

转载 作者:可可西里 更新时间:2023-11-01 03:13:39 26 4
gpt4 key购买 nike

在 C# 中,我有 a 类型的变量 string

如何在 combobox 中通过 a 的值查找项目(我想查找值不显示组合框文本的项目)。

最佳答案

您可以使用以下代码找到它。

int index = comboBox1.Items.IndexOf(a);

要获取项目本身,请写:

comboBox1.Items[index];

关于c# - 如何在 C# 的组合框中按值查找项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10160708/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com