如何比较两个组合项目,即使至少一个匹配都发现了C#
我正在尝试比较两个组合项目,如果它们甚至具有单个项目匹配该项目,以及如何设置显示消息的条件作为匹配?
之类的ID
Combo10已经具有1001 1003 1004 1100
CombObox1获取Combo10 Text选择
我的问题时如何使用C#(Winforms)的重复项目(ID)来计算
下面的ComboBox1(Winforms)是我在按钮事件中使用的代码,但是
var itms1 = combo10.Items;
var itms2 = comboBox1.Items;
foreach (var itm in itms2)
{
if (comboclass.Text == lblclasstext.Text)
{
if (itms1 == itm)
{
lbldone.Visible = true;
lbltomark.Text = "";
}
}
}
有人可以帮助吗?
I am trying to compare two comboboxes items if they have even single items match count that item and how to set condition for display message as match found?
combo10 already has IDs like
1001
1003
1004
1100
comboBox1 gets IDs when combo10 text get selected
My question is how to count repeated items(IDs) of combobox1 using c#(winforms)
Below is the code i have used in button event but it is not working
var itms1 = combo10.Items;
var itms2 = comboBox1.Items;
foreach (var itm in itms2)
{
if (comboclass.Text == lblclasstext.Text)
{
if (itms1 == itm)
{
lbldone.Visible = true;
lbltomark.Text = "";
}
}
}
Can anybody help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
其他替代方法是双循环以比较每个组合的列表
Other alternative method is to double loop to compare list of each comboboxes
将其适应您的代码,您应该得到所需的东西。
Adapt this to your code and you should get what you need.