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.
Refer Total words,Characters,sentence,length of ... also.
A) Program Design :
(B) Property(Controls Used) :
- Two Labels and change their CAPTIONS as : Enter a Paragraph and Search rightmost character.
- Two Text Boxes
- 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)
- ====================================================================
===========================================================
No comments:
Post a Comment