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

 

 

Advertisements