如何在c#WinForm中比较两个文本框的字母数字值 [英] How to compare two textbox alphanumeric values with each other in c# WinForm
本文介绍了如何在c#WinForm中比较两个文本框的字母数字值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在c#WinForm中比较两个文本框的字母数字值。我想在我输入文本框时验证
How to compare two textbox alphanumeric values with each other in c# WinForm.I want to validate whenever i typed into textbox
推荐答案
你可以使用 TextChanged事件 [ ^ ]。
You can use the TextChanged event[^].
private void yourTextBox_TextChanged(object sender, EventArgs e)
{
string value1 = textBox1.Text;
string value2 = textBox2.Text; // change the names here
// now you can compare value1 and value2 the way you want, for example:
if (value1 == value2)
{
// text is equal
}
else
{
// text is not equal
}
}
这篇关于如何在c#WinForm中比较两个文本框的字母数字值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文