Comparing Two Strings Using VB.Net
This tutorial is all about Comparing Two Strings Using VB.Net. With this tutorial you can Comparing Two Strings Using VB.Net. easily. So let’s get started:
When two expressions are compared, a Boolean value representing the relationship between their values is returned. Numeric comparison operators, string comparison operators, and object comparison operators are all available. This article covers all three types of operators.
- First is open the Visual Basic, Select File on the menu, then click New and create a new project.
- Then a New Project Dialog will appear. You can rename your project, depending on what you like to name it. After that click OK
- Design your form like this just like what I’ve shown you below.
Add a Button, and 2 Textbox.
- Then, Add this code to the button.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim word1 As String = TextBox1.TextDim word2 As String = TextBox2.TextIf String.Compare(word1, word2, True) = 0 Then MsgBox("Strings Match") Else MsgBox("Strings Do not Match") End If End Sub
- Finally, Click F5 to run Program
If you have any comments or suggestion about comparing Two Strings Using VB.Net, Please Feel Free to contact our webpage.
Download Source Code! Here
Other articles you might read also: