| | |
I'm looking for words counter code
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2005
Posts: 3
Reputation:
Solved Threads: 0
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...
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...
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
Mkay, Here is the similar VB.NET Code, To split a string, and grab it's ubound of the return array:
VB.NET Syntax (Toggle Plain Text)
Dim parts() As String parts = TextBox1.Text.Split(" ") WordCount = parts.GetUpperBound(0) ' /* I don't know if this need a + 1 or not */
•
•
Join Date: May 2005
Posts: 3
Reputation:
Solved Threads: 0
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...
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...
I don't really like VB.NET, so the code is in VB6
VB.NET Syntax (Toggle Plain Text)
Function WordCounter(words) As Integer Dim strTemp As String Dim counter As Integer strTemp = Split(words, " ") counter = UBound(strTemp) For i = 0 To counter If strTemp(i) = "" Then counter = counter - 1 End If Next i WordCounter = counter + 1 End Function
![]() |
Similar Threads
- Simple Counter Code (ASP)
Other Threads in the VB.NET Forum
- Previous Thread: Help me for how Crystal report is used with VB.NEt
- Next Thread: Simple Hangman Game
| Thread Tools | Search this Thread |
"crystal .net .net2005 .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons click code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationthesis dissertationtopic dosconsolevb.net editvb.net employees excel exists firewall forms html image images isnumericfuntioncall listview login map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pdf picturebox2 port print printpreview record regex reports" reuse right-to-left save savedialog search serial settings socket sqldatbase sqlserver storedprocedure string temp textbox timer transparency txttoxmlconverter useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic.net visualstudio.net web wpf wrapingcode xml






