Home
Unlabelled
How to Convert Positive and Negative Numbers in VB 6.0 and VB.NET
How to Convert Positive and Negative Numbers in VB 6.0 and VB.NET
Advertisement
This simple post is to show you how to convert a positive number to a negative number, plus to show how to convert a negative number to a positive number. Both Visual Basic 6.0 and Visual Basic.NET are supported using the code below. (with VB 2005, 2008, 2010, 2012 included). To do this is actually very simple with very basic code. To convert a Negative Number (Example: -100), to a positive number you simply use the ABS function. The ABS function will return the absolute value from an integer number (whether positive or negative). To convert a positive number to a negative is easy as well. Simply multiple the positive number by a negative one (Example: 100 x -1). Below starts the code for converting a negative number to a positive number. The code below will convert a positive number to a negative number. Thats all there is to it! Hopefully this little tip helped you out. Jason
EmoticonEmoticon