Word Count Help !!

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Word Count Help !!

 
0
  #11
Feb 27th, 2007
Hi,

Sorry, Little bit of Modification in my previous post :
Just Change For Loop this way :

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2.  
  3. For i = 10 To 2 Step -1
  4. MyStr = Replace(MyStr, Space(i), Space(1))
  5. Next
  6. MyCntArray = Split(MyStr, " ")
  7. MsgBox UBound(MyCntArray)


Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 51
Reputation: dmf1978 is an unknown quantity at this point 
Solved Threads: 7
dmf1978's Avatar
dmf1978 dmf1978 is offline Offline
Junior Poster in Training

Re: Word Count Help !!

 
0
  #12
Feb 27th, 2007
Originally Posted by QVeen72 View Post
Hi,

Sorry, Little bit of Modification in my previous post :
Just Change For Loop this way :

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2.  
  3. For i = 10 To 2 Step -1
  4. MyStr = Replace(MyStr, Space(i), Space(1))
  5. Next
  6. MyCntArray = Split(MyStr, " ")
  7. MsgBox UBound(MyCntArray)

Regards
Veena
Veena, you must be joking! :lol:
Don't you? :-|

Try this with your code "Hello world" and please post how many words your program find.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 16
Reputation: Kcin is an unknown quantity at this point 
Solved Threads: 1
Kcin Kcin is offline Offline
Newbie Poster

Re: Word Count Help !!

 
0
  #13
Feb 27th, 2007
Originally Posted by dmf1978 View Post
Veena, you must be joking! :lol:
Don't you? :-|

Try this with your code "Hello world" and please post how many words your program find.
i got 1
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Word Count Help !!

 
0
  #14
Feb 28th, 2007
Hi,

Did u look into my last post???? I have corrected there.

MsgBox UBound(MyCntArray)


Remove "-1"

Regards

Veena
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Word Count Help !!

 
0
  #15
Feb 28th, 2007
Hi

This is My Complete. Code.

Private Sub CmdCount_Click()
    Dim MyCntArray
    Dim MyStr As String
    Dim i As Integer
    '
    MyStr = TextBox1.Text
    '
    For i = 10 To 2 Step -1
        MyStr = Replace(MyStr, Space(i), Space(1))
    Next
    ' Replace All the multiple Spaces with single spaces 
    ' here i have given for max 10 spaces, 
    ' u can change it to a higher value
    '
    MyCntArray = Split(MyStr, " ")
    MsgBox "Number Of Words : " & UBound(MyCntArray) 
    '
End Sub


I hope at least now, it is Clear.

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 16
Reputation: Kcin is an unknown quantity at this point 
Solved Threads: 1
Kcin Kcin is offline Offline
Newbie Poster

Re: Word Count Help !!

 
0
  #16
Feb 28th, 2007
Thx Guys, I got it to work.
Thank you for all your help.

Love You all.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 9
Reputation: arty56 is an unknown quantity at this point 
Solved Threads: 0
arty56 arty56 is offline Offline
Newbie Poster

Re: Word Count Help !!

 
0
  #17
Aug 17th, 2008
Originally Posted by dmf1978 View Post
I have uploaded a sample VB6 project to demonstrate the use of this function.
excellent code.
worked first time for me and is better than heaps of other examples.
Thanx 4 da code
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 51
Reputation: dmf1978 is an unknown quantity at this point 
Solved Threads: 7
dmf1978's Avatar
dmf1978 dmf1978 is offline Offline
Junior Poster in Training

Re: Word Count Help !!

 
0
  #18
Aug 17th, 2008
Originally Posted by arty56 View Post
excellent code.
worked first time for me and is better than heaps of other examples.
Thanx 4 da code
Hey, thanks
-- Martín
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 9
Reputation: arty56 is an unknown quantity at this point 
Solved Threads: 0
arty56 arty56 is offline Offline
Newbie Poster

Re: Word Count Help !!

 
0
  #19
Aug 17th, 2008
Originally Posted by dmf1978 View Post
Hey, thanks
perhaps you have an answer for reading the total characters in a text box
and a way of limiting the number.

I've spent 93 mins so far and can not find a suitable answer.
Regards
Arty
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Word Count Help !!

 
0
  #20
Aug 18th, 2008
Originally Posted by arty56 View Post
perhaps you have an answer for reading the total characters in a text box
and a way of limiting the number.

I've spent 93 mins so far and can not find a suitable answer.
Regards
Arty
Yes,
This gives you length of Characters in the TextBox..
MsgBox Len(Text1.Text)

You can Limit the TextBox Setting its MaxLength
Text1.maxLength =10

Regards
Veena
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 7688 | Replies: 22
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC