It should work exactly as it is
VB Code:
  1. Private Sub cmdsentences_Click()
  2.     Dim Sentence As String, Char As String 'setting the data types
  3.     Dim Count As Integer, I As Integer 'setting the data types
  4.     Count = 0 'initialise the count to 0
  5.     Sentence = Trim(txtInput.Text) 'set the end of the sentence.
  6.     If Len(Sentence) > 0 Then 'if there is no text, count stays at zero
  7.  
  8.         Sentence = Replace$(Sentence, "?", ".")
  9.         Sentence = Replace$(Sentence, "!", ".")
  10.         Do Until Instr(Sentence, "..") = 0
  11.             Sentence = Replace$(Sentence, "..", ".")
  12.         Loop
  13.  
  14.         For I = 1 To Len(Sentence) 'when it does have characters then execute instructions
  15.             Char = Mid(Sentence, I, 1) 'characters in sentence
  16.             If Char = "." Or Char = "?" Or Char = "!" Then 'characters which show end of sentence(loop begins)
  17.                 Count = Count + 1 'add one to count
  18.             End If
  19.         Next I
  20.  [b]Don't need to do this=>[/b] Count = Count 'count remains the same
  21.     End If
  22.     lblCountsentences.Caption = Count 'where to display the result
  23. End Sub