943,618 Members | Top Members by Rank

Ad:
Jul 6th, 2009
0

Counting Numbers inside text area

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
nagatron is offline Offline
99 posts
since Aug 2008
Jul 6th, 2009
0

Re: Counting Numbers inside text area

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
Reputation Points: 19
Solved Threads: 115
Nearly a Posting Virtuoso
cguan_77 is offline Offline
1,317 posts
since Apr 2007
Jul 6th, 2009
0

Re: Counting Numbers inside text area

Click to Expand / Collapse  Quote originally posted by cguan_77 ...
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
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Jul 7th, 2009
0

Re: Counting Numbers inside text area

Hmm..that's really better..
Reputation Points: 19
Solved Threads: 115
Nearly a Posting Virtuoso
cguan_77 is offline Offline
1,317 posts
since Apr 2007
Jul 7th, 2009
0

Re: Counting Numbers inside text area

thank you so much it is solved. . .
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
nagatron is offline Offline
99 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Anyone know how to add column on the vb datagrid
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Reading a binary file in chunks...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC