Search word by vb program
'controls Property Setting 'Textbox1 Name txtText ' Caption - 'Textbox2 Name txtWord ' Caption - 'Label1 Name lbl ' Caption Enter Text 'Label2 Name lbl ' Caption Enter Word for search 'Label3 Name lblResult ' Caption 'command1 Name cmdSearch Caption OK '----------------------------------------------------- ' CODE Private Sub cmdSearch_click() Dim lenmain as Integer, lenword as Integer Dim word as String, flag as String flag =0 lenmain =Len(txtText.text) lenword =Len(txtWord.text) for a=1 To lenmain word=Mid(txtText.text,a,lenword) If word=txtWord.text Then flag=flag+1 End If Next lblResult.Caption = Str(flag) End Sub
No comments:
Post a Comment