-
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
-
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]
-
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
-
I'm sorry but add them to what?
-
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.
-
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]