Results 1 to 27 of 27

Thread: Help!

Hybrid View

  1. #1
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Help!

    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
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Aug 2005
    Location
    perth
    Posts
    30

    Re: Help!

    i put that in, but it doesnt like the replace$ thing. i'm not sure why?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width