Click here to Skip to main content
15,039,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys,

Could you help me ,
I'm having some problem in the negative sign(-) in the integer.
all i want is to remove the negative sign in the integer
but i just dont know ....

here's my code...
<br />
If RS1_1.Checked = True Then<br />
   Temp_PC = Temp_PC + 1<br />
Else<br />
   Temp_PC = Temp_PC - 1<br />
   TXTSPC.Text = Temp_PC<br />
End If<br />

please help..

If you want to make a number be positive, no matter how it starts, use Math.Abs. If you want to remove the sign from a string, you can use math.Abs, or String.Replace.

You should consider buying a basic VB.NET book to help you with these sort of questions.
Use the Math.Abs() method.

EDIT -----------

Sorry, didn't know Christian had already suggested it. If the OP had marked it as answered, I wouldn't have bothered with a response.
AspDotNetDev 14-Jul-10 14:34pm
FYI, you can just delete your answer if you like. I could too, but I figured I'd leave the decision up to you.
Hi, here is a solution for your question.

if arrval is a negative value
if (arrval < 0)
           arrval = arrval * (-1);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900