It is displayed as "(46)" beacuse that is what your format specifier
("#,##0.00;(#,##0.00);0.00") is asking it to do for negative numbers.
Since the Convert.ToDouble function does not recognize this format, you
could check for the format you're looking for and change it appropriately:
For example:
string sText = TextBox3.Text
if (sText.StartsWith("("))
sText = "-" + sText.Remove("(").Remove(")")
end if
TextBox5.text = Convert.ToDouble(sText) + Convert.ToDouble(Textbox4.text)
Or, probably the better way to do this is to just use the result in AString
which is already a double and stores the value that you're looking for
anyways.
--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Charles A. Lackman" <Ch*****@CreateItSoftware.net> wrote in message
news:e%****************@TK2MSFTNGP12.phx.gbl...
Hello,
I have some textboxes that are doing addition:
Dim AString As Double
AString = Convert.ToDouble(TextBox1.Text) -
Convert.To(DoubleTextBox2.Text) TextBox3.Text = AString.ToString("#,##0.00;(#,##0.00);0.00")
When the result is negative it is displayed as "(46)" or whatever the
value is.
This makes it impossible to test for a negative number to make further
additions:
TextBox5.text = Convert.ToDouble(TextBox3.text) +
Convert.ToDouble(Textbox4.text)
Is there a work-around for this? I must have negative numbers that can
be added together.
Thanks,
Chuck