Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Monday, July 11, 2011

VB-35 : Find rightmost occurrence of n-length string

Write an event procedure to find and display the rightmost occurrence of an input character of a n-length string.

Refer  Total words,Characters,sentence,length of ... also.
A)    Program Design : 




(B) Property(Controls Used) :
  1. Two Labels and change their CAPTIONS as : Enter a Paragraph and Search rightmost character.
  2. Two Text Boxes 
  3. One Command Button and change its CAPTION as : Find character.

(C) Attaching Code to the Object :

Private Sub Command1Find_Click()
Dim str As String
str = Text1.Text
i = 0

For i = Len(str) To 1 Step -1
t = Mid(str, i, 1)

If t = txtchar Then

Text1.SelLength = i - 1
Text2.SelStart = 1
GoTo cmd_end
End If
Next i

cmd_end:

End Sub


(Some error in output)


      • ====================================================================
        Back to Home   &  VB
    ===========================================================

    No comments: