ARTICLE

Working of Like keyword to comparison in VB.NET

Posted by Manish Tewatia Articles | Visual Basic Language July 23, 2010
This article is about the Like keyword functionality in Vb.NET
 
Reader Level:

In this article I explain the Like keyword functionality in VB.NET. Like keyword is used to compare the two values whether both of the values entered by user at run time or already specify in the program. I take a example to demonstrate the working below example explain you to how you can set a pattern and than enter a value and compare both of them on console screen.

Examples

    Module Module1
        Sub Main()
            Dim UserInput As String
            Dim
Pattern As String
            Dim
Match As String
            System.Console.Write("Please Enter A Pattern:")
            UserInput = System.
Console.ReadLine()
            Pattern = UserInput
            System.
Console.Write("Please Enter A value To Compare With Pattern:")
            UserInput = System.
Console.ReadLine()
            Match = UserInput
            If Match Like Pattern Then
                System.Console.WriteLine(Match & " Matched with " & Pattern)
            Else
                System.Console.WriteLine(Match & " did not Match with " & Pattern)
            End If
                Console.ReadLine()
        End Sub
    End
Module

OUTPUT

 4.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor