Program to Create a VB.NET desktop application to check the string/char exists in an entered name.

Program UI :

141

 

Program Code :

Public Class Searching

Private Sub btnExit_Click(sender AsObject, e AsEventArgs) HandlesbtnExit.Click

Close()

End Sub

Private Sub btnClear_Click(sender AsObject, e AsEventArgs) HandlesbtnClear.Click

txtChrStr.Clear()

txtSearch.Clear()

End Sub

 

PrivateSubbtnSearch_Click(sender AsObject, e AsEventArgs) HandlesbtnSearch.Click

Dim Str, Search As String

Dim Len1, Len2, i, f AsInteger

f = 0

Str = txtChrStr.Text

Search = txtSearch.Text

Len1 = Str.Length

Len2 = Search.Length

Fori = 1 To Len1

If Search = Mid(Str, i, Len2) Then

f = 1

EndIf

Next

 

If f = 1 Then

MsgBox(“Exist !!!”)

Else

MsgBox(“Not Exist !!!”)

End If

End Sub

 

End Class

Output:

14

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s