The argument needs to be optional defaulting to true, so that the existing call to the function doesn’t need to be modified. I also need to add a second button to my form that provides a case-insensitive count. This is what I have so far.
Public Function WordCount(ByVal sInput, ByVal sSentence) As Integer
WordCount = 0
Dim i As Integer
For i = 1 To Len(sSentence)
Debug.Print(Mid(sSentence, i, Len(sInput)))
If Mid(sSentence, i, Len(sInput)) = sInput Then
WordCount = WordCount + 1
End If
Next i
End Function
Private Sub cmdCompare_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCompare.Click
Label.Text = WordCount(TextBox1.Text, TextBox2.Text)
End Sub
2006-12-13
00:51:33
·
2 answers
·
asked by
bhs00
2
in
Programming & Design