English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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 Computers & Internet Programming & Design

2 answers

Suppose that the third argument is named "caseSensitive", you will need add this to the beginning of the function:

''''''''' Beginning of Code
if !caseSensitive then
sInput=toUpper(sInput)
sSentence=toUpper(sSentence)
end if
''''''''' End of Code

Enjoy ;)

2006-12-13 01:52:03 · answer #1 · answered by Ahmad Nasser 2 · 0 0

a million. you rather a lot threw the e book at the same time as reading Order of the Phoenix because of Umbridge's moves pretend 2. distinct the flaws Draco stated about Harry were authentic authentic 3. Harry will be someone you could get alongside with pretend ( I only don't have the endurance for that. =/ ) 4. without Luna, the books would not be a similar authentic 5. Hermione aggravated you oftentimes authentic 6. You felt undesirable for Bellatrix pretend 7. You cheered at the same time as Voldemort died authentic 8. Ron Weasley is large! authentic

2016-10-18 05:36:14 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers