I'm looking for words counter code

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2005
Posts: 3
Reputation: LuckyMan is an unknown quantity at this point 
Solved Threads: 0
LuckyMan LuckyMan is offline Offline
Newbie Poster

I'm looking for words counter code

 
0
  #1
May 30th, 2005
Hi there...

I'm looking for words counter code

I build the form which contain textbox and botton

and I'm stopped at the code, I just did the code that count the space between each word

but I think it stills need more things to add

and if you have any ways to build this project

reply me

and I'm here to look for your help

please reply soon...
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: I'm looking for words counter code

 
0
  #2
May 30th, 2005
I don't have .NET, so I'll give you the breakdown of what I would do. There is a command, called "split" that allows you to rip a string apart, by a certain delimiter (character). It Returns an array. What I would do is split the string by space, and then test how many elements of the array there are. That may not tell you how many words, but it will certainly tell you how many parts of a string there is seperated by a space
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 3
Reputation: LuckyMan is an unknown quantity at this point 
Solved Threads: 0
LuckyMan LuckyMan is offline Offline
Newbie Poster

Re: I'm looking for words counter code

 
0
  #3
May 31st, 2005
thanks Comatose for your advise

i try to do what you suggest but it still not working

I have .net and VB 6 so i would like to give me your code

if you can..
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: I'm looking for words counter code

 
0
  #4
May 31st, 2005
Alright, here is the VB6 Equivelant code for what you want to do. The same concept will apply in .NET, but I know that the syntax is different. I'll research the same code on google, and post the code for doing this in .NET.
Attached Files
File Type: zip WordCounter.zip (1.9 KB, 56 views)
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: I'm looking for words counter code

 
0
  #5
May 31st, 2005
Mkay, Here is the similar VB.NET Code, To split a string, and grab it's ubound of the return array:
  1. Dim parts() As String
  2. parts = TextBox1.Text.Split(" ")
  3. WordCount = parts.GetUpperBound(0) ' /* I don't know if this need a + 1 or not */
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 3
Reputation: LuckyMan is an unknown quantity at this point 
Solved Threads: 0
LuckyMan LuckyMan is offline Offline
Newbie Poster

Re: I'm looking for words counter code

 
0
  #6
May 31st, 2005
thank you very mach Comatose for your help

the first code was smiller what did before. it just count the speces . but if you put many spaces in the textbox the counter will count it !!

i don't know if there is way to avoid count two or more spaces if they are togather.

and about the second code is not working with me, maybe i have to change the variable ... will try it and will post to you..


thanks...
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 464
Reputation: invisal is a jewel in the rough invisal is a jewel in the rough invisal is a jewel in the rough 
Solved Threads: 49
invisal's Avatar
invisal invisal is offline Offline
Posting Pro in Training

Re: I'm looking for words counter code

 
0
  #7
Jun 1st, 2005
I don't really like VB.NET, so the code is in VB6

  1. Function WordCounter(words) As Integer
  2.  
  3. Dim strTemp As String
  4. Dim counter As Integer
  5. strTemp = Split(words, " ")
  6. counter = UBound(strTemp)
  7.  
  8. For i = 0 To counter
  9. If strTemp(i) = "" Then
  10. counter = counter - 1
  11. End If
  12. Next i
  13.  
  14. WordCounter = counter + 1
  15.  
  16. End Function
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,036
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 130
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is online now Online
The Queen of DaniWeb

Re: I'm looking for words counter code

 
0
  #8
Nov 12th, 2005
No one in this thread likes VB.NET it seems
(Sorry, just making an unconstructive observation)
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: I'm looking for words counter code

 
0
  #9
Nov 12th, 2005
As Far As I'm Concerned, .NET is the Bane of Windows Programming. I'd Rather Write An Entire App For Windows in ASM :eek:
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 19
Reputation: troupm is an unknown quantity at this point 
Solved Threads: 0
troupm troupm is offline Offline
Newbie Poster

Re: I'm looking for words counter code

 
0
  #10
Nov 15th, 2005
LuckyMan- you may want to check out "Regular Expressions" on msdn or even Google; it is native to VB .NET (and Pearl, etc) and has powerful string parsing functions that, I hope, will make everything much easier.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC