Monday, 12 March 2012

vb.net string equals()?


How to string equals() in vb.net?
I this tutorial you can learn how to get a string equals (compare to string)  declare first string and second string and compare using if condition  
Step1:
Open Microsoft visual studio 2010 or any older version also may differ commands
Step2:
Open file new project(ctrl+shift+n)àselect windows form applicationà rename as you wish
Step3:
Drag and drop two label, textbox, and one button
Label1.textà1st string
Label2.textà2nd string
Buttonàcheck
Step4:
Copy and paste the following code
    Public Class Form1
   
    Private SubButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click
        Dim ststring As String = TextBox1.Text
        Dim ndbstring As String = TextBox2.Text
        If String.Equals(ststring, ndbstring) Then
            MessageBox.Show("string are equals")
        Else
            MessageBox.Show("strings are not equals")
        End If

    End Sub
End Class

 Output: