在C#中比较两个文本框 [英] Compare Two Textbox in C#,net

查看:70
本文介绍了在C#中比较两个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

我想比较VB.NET中的两个文本框值(例如ASP.NET中的"CompareValidator").
这是Windows应用程序.

例如:
创建登录表单中的密码和符合密码.

代码:

Hi friends,

I would like to compare two text box values (like "CompareValidator" in ASP.NET ) in VB.NET.
It is a Windows Application.

For Example:
Password and Conform Password in the Create Login form.

Code:

If txtPassword.Text = txtConformPassword.Text
    "Do Something"
end if


我想要一个可以在项目中以任何形式使用的函数.

那么,请问如何实现呢?

谢谢和问候,
Lakshmi narayanan.S


I would like a function usable in any form in my project.

So please how to achieve this ?

Thanks and Regards,
Lakshmi narayanan.S

推荐答案

.Net框架已经在 ^ ].

这应该有帮助
The .Net Framework already has several built in string comparer functions[^] .

That should help


我不太了解,但这是一种方法,它将接受两个字符串并告诉您它们是否相等

I don''t really understand but here is a method that will take two strings and tell you if they are equal

Public Function IsPasswordsEqual(password1 As String, password2 As String) As Boolean
    If password1.Equals(password2) Then
        Return True
    End If

    Return False
End Function


这篇关于在C#中比较两个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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