如何从Textbox获取值并将其存储在字符串中,然后从Combobox获取所有值 [英] How to get the value from Textbox and store it in string and then get all the values from Combobox

查看:56
本文介绍了如何从Textbox获取值并将其存储在字符串中,然后从Combobox获取所有值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从Textbox中获取值并将其存储在字符串中,然后从Combobox中获取所有值。



将文本框中的字符串与每个字符串进行比较来自Combobox的元素。



如果有人匹配那么表明它已经存在?

How do I get the value from Textbox and store it in string, and then get all the values from Combobox.

Compare the string from the Textbox with each element from the Combobox.

If anyone matches then show that it was already been there?

推荐答案

TextBox.Text 已经是。您可以直接使用它,如

bool alreadyThere = ComboBox.Items 包含(TextBox.Text);
TextBox.Text is already of type string. You can use it directly as in
bool alreadyThere = ComboBox.Items.Contains(TextBox.Text);


将项目添加到组合框 [ ^ ]


这篇关于如何从Textbox获取值并将其存储在字符串中,然后从Combobox获取所有值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆