Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Hyphen from a Number

Status
Not open for further replies.

alleycat1

Technical User
Dec 16, 2008
5
US
I am a technical user trying to remove a hyphen from a number. The Number -125987.50 should be 125987.50. Instead of -125987.50 I want to remove the hyphen before is assigned to another textbox field.

Does VB have a function to do this?

AlleyCat1
 

-125987.50 * -1 = 125987.50

If you were doing this with text boxes, do something like this:

TextBox1.Text = "-125987.50"

TextBox2.Text = (-1 * Val(TextBox1.Text)).ToString

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
if textboxes you are using what about
textbox2.text=textbox1.text.replace("-","")
the more .net way of doing it i suppose
loads of ways of doing this - if it is a user inputting this need to validate the input ie number, decimal places etc
 
If you're working strictly with numeric values in the text boxes, it appears you're looking for the absolute value of the number.

Have you considered the Math.Abs(value) method?
 
I am trying to Inner Join Two Tables in a DataBase that I have made an SQL Connection To. I am trying to pull data some extra data fields by Company. The GLTRANS and GLNAMES Tables both contain Primary Keys on the Field COMPANY.

I am pulling data into an Array so that I can reference each String Part by Name.

My Coding is giving an SQL EXCEPTION: An expression of non-boolean type specified in a context where a condition is expected, near 'WHERE'. I can't seem to find the exception...

This Exception Appears and is yellowed on ODA.Fill(oTable)

SQL CODING: Dim sSQL As String = "SELECT COMPANY, FISCAL_YEAR, ACCT_PERIOD, CONTROL_GROUP, LINE_NBR, POSTING_DATE, OBJ_ID, STATUS, ACCT_UNIT, ACCOUNT, TRAN_AMOUNT, ACCT_AMOUNT, VAR_LEVELS FROM GLTRANS INNER JOIN GLNAMES ON COMPANY WHERE COMPANY = " & sParm & ";"

Any help is appreciated.

AlleyCat


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top