Counting Numbers inside text area

Thread Solved

Join Date: Aug 2008
Posts: 77
Reputation: nagatron is an unknown quantity at this point 
Solved Threads: 0
nagatron nagatron is offline Offline
Junior Poster in Training

Counting Numbers inside text area

 
0
  #1
Jul 6th, 2009
I am having a problem on how to count numbers inside text area. . .

example: In my text area I have 10 numbers.

12, 06, 31, 22, 53, 28, 96, 71, 10, 47

the the program should count how many 0,1,2,3,4....9 excluding the comma. I don't know how to do this inside a text area or a multiline text box. Can anyone help me or give an example or idea on how to do this. . . .please.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 1,102
Reputation: cguan_77 has a little shameless behaviour in the past 
Solved Threads: 91
cguan_77's Avatar
cguan_77 cguan_77 is offline Offline
Veteran Poster

Re: Counting Numbers inside text area

 
0
  #2
Jul 6th, 2009
try this:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2. Sub xx()
  3. Dim txt As String
  4. Dim x As Variant
  5. Dim i As Long
  6. txt = "10,11,12,13,14,15,16,17,18,1,2,3,4"
  7. x = Split(txt, ",")
  8. For i = 0 To UBound(x): Next i
  9. MsgBox "There are " & i & " numbers in your text area"
  10. End Sub
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 809
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 147
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Counting Numbers inside text area

 
0
  #3
Jul 6th, 2009
Originally Posted by cguan_77 View Post
try this:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2. Sub xx()
  3. Dim txt As String
  4. Dim x As Variant
  5. Dim i As Long
  6. txt = "10,11,12,13,14,15,16,17,18,1,2,3,4"
  7. x = Split(txt, ",")
  8. For i = 0 To UBound(x): Next i
  9. MsgBox "There are " & i & " numbers in your text area"
  10. End Sub
Ahhh....

Why not just use ubound+1?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2. Sub xx()
  3. Dim txt As String
  4. Dim x As Variant
  5. Dim i As Long
  6. txt = "10,11,12,13,14,15,16,17,18,1,2,3,4"
  7. x = Split(txt, ",")
  8. MsgBox "There are " & UBound(x) + 1 & " numbers in your text area"
  9. End Sub

Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 1,102
Reputation: cguan_77 has a little shameless behaviour in the past 
Solved Threads: 91
cguan_77's Avatar
cguan_77 cguan_77 is offline Offline
Veteran Poster

Re: Counting Numbers inside text area

 
0
  #4
Jul 7th, 2009
Hmm..that's really better..
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 77
Reputation: nagatron is an unknown quantity at this point 
Solved Threads: 0
nagatron nagatron is offline Offline
Junior Poster in Training

Re: Counting Numbers inside text area

 
0
  #5
Jul 7th, 2009
thank you so much it is solved. . .
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC