| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

08-26-04, 15:41
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 16
|
|
|
EASY help, change a number
|
|
I feal stupid not figuring this out.
If I capture a number from a site, and it says 1,200
how can I take the "," away to make it 1200?
This is in Visula Basic. I have a label with the captured number.
|
Last edited by Lord_Saroman; 08-26-04 at 16:49.
|

08-27-04, 15:28
|
|
Registered User
|
|
Join Date: Feb 2004
Location: NJ
Posts: 37
|
|
this may not be the best way to do this but it would work. Assuming that the number you have can be stored as a string
Dim inputnumber As string 'The number you want to remove the comman from
Dim number() As String
Dim left As String
Dim right As String
Dim total as String
Dim totalint As integer
number = Split(inputnumber, ",")
left = number(0)
right = number(1)
total = left & right
if you want to turn that number back to an integer
totalint = val(total)
that should work
|
|

08-27-04, 16:48
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 16
|
|
|
|
I didnt get it working,.. Maybe I did something wrong..
the number I want to change, is not always the same. I have a label in my form called "three" this is where the number is captured. Please expain the code, and how to use it.
|
|

08-27-04, 21:13
|
|
Registered User
|
|
Join Date: Feb 2004
Location: NJ
Posts: 37
|
|
what exactly do you mean by you have a label where the number is captured. Can you show some of the code to do that or give a little more information? Assuming that the number you are pulling from the website is a string then the code i provided should work. If it is an integer then you would have to create a new variable as a string and then set it equal to the integer you are pulling from the website. The Split function works with strings. Essentially, I stored the integer string into the array "number". Split separates the string by the delimiter you set, in this case it is the comma. Then left would be the first element in the array (which is the information to the left of the comma. Right would be the second element in the array (the number to the right of the comma). Then i took both those strings and stored them as one string (so the whole string would be 1200). You can then convert that to an integer you the val function if you need to do math or something with it.
|
|

08-31-04, 05:10
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 16
|
|
I am all new to this, So Dont really know what a string is yet. So I will expain in detail..
The number I capture is a part of a text in a website, So I had to use this to capture the number I wanted. I now have a label in my app. called "armysize", where the number I captured is shown.
Set d = Browser1.Document
armysize.Caption = Mid(d.body.innerText, InStr(1, d.body.innerText, "Army Size:") + 10, InStr(InStr(1, d.body.innerText, "Army Size:"), d.body.innerText, vbLf) - InStr(1, d.body.innerText, "Army Size:") - 10)
The only thing left now is to change the number I've captured, without the ","
|
|

08-31-04, 07:12
|
|
Registered User
|
|
Join Date: Jul 2003
Location: Amsterdam, Nederland
Posts: 449
|
|
|
Format the number
you should use the format function
Dim x as string
Dim myNumber as long
X= ""
X= capture
' x will now be 1,200
myNumber=Format(X,"####00")
'myNumber now should be 1200
|
|

08-31-04, 13:30
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 16
|
|
still no go..
Will someone plz contact me on AIM: EirikTheKing
Really need to get this code right
|
|

08-31-04, 16:33
|
|
Super Moderator
|
|
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
|
|
myNumber=Format((cdbl(X),"####00")
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert
|
|

09-01-04, 10:06
|
|
Registered User
|
|
Join Date: Jul 2004
Posts: 69
|
|
Quote:
|
Originally Posted by Lord_Saroman
I feal stupid not figuring this out.
If I capture a number from a site, and it says 1,200
how can I take the "," away to make it 1200?
This is in Visula Basic. I have a label with the captured number.
|
Hi! im just trying to answer based on your given example. trying to get the (,) comma from 1,200 to make it 1200 right? let's assume that the value of variable num is 1,200 then after getting rid of the comma, it'll be shown on a msgbox.
num = Replace(num, "," , "")
Msgbox num
That's all...
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|