|
-
Oct 9th, 2000, 12:29 PM
#1
Thread Starter
Lively Member
hi again now i need to know, that how can i extract numeric values from a list box, problem is that i can use the "right" and "left" funtion but i have some thing which looks like this: "2 Cars $17, 000" in a list box how do i extract only the 17000 and not the "2". thanks again
-
Oct 9th, 2000, 12:53 PM
#2
Frenzied Member
Is the right value alway money? (so it will always contain $?)
Code:
Private Sub Command1_Click()
Static x As Integer
Dim str As String
For x = 0 To List1.ListCount - 1
str = str & Right(List1.List(x), Len(List1.List(x)) - InStr(1, List1.List(x), "$", vbTextCompare)) & vbcrlf
Next x
End Sub
It looks a bit complicated, I know, I can clear it up if you need.
(you still need it for the printinf stuff?)
[Edited by Jop on 10-09-2000 at 01:56 PM]
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 9th, 2000, 01:04 PM
#3
Thread Starter
Lively Member
thanks again but...
thanks again, i was able to print it before with your code, that worked beautifully but the reason i need to now this was so that i could extract the numerical values and from the listbox and then add them, well i suppose that's the next problem... after the numeric value is extracted i need to add them
-
Oct 9th, 2000, 02:08 PM
#4
Frenzied Member
I'm sorry but add them to what?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 9th, 2000, 03:27 PM
#5
Addicted Member
I think he wants only the numeric values from a sentence Jop. I think that is what he meant. I think the function you are looking for is Val.
-
Oct 10th, 2000, 10:13 AM
#6
Frenzied Member
I think my function only add's the money value, and that's what he wants (I think), but he wants to add it to something (dunno what )
And I don't think the Val function is suitable for this, because it search for numbers, and stops when a character is found, so it'll stop at the 2
<Jop is editing>
Ow I now see he want to add the numbers:
5 + 5 = 10 
[Edited by Jop on 10-10-2000 at 11:15 AM]
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|