Question negative format

k_cire0426

New member
Joined
Apr 22, 2008
Messages
4
Programming Experience
1-3
Hi everybody,
This is my first post hope you count on me..hehehe :D
Well anyway my problem is it is about the negative number format. I had a textbox which is a third party control. Everything was ok in XP but when my textbox goes to Vista the negative format set to right...
(-1000.00) XP

I found out that when the property "RightToLeft" of textbox set to "Yes" in Vista .
(1000.00-) Vista

any idea on how to fix this?
 
Actually, I would be looking into the system's regional settings instead... You will find a number format panel in there where you can tell much stuff about how numbers are formatted, including where to put the minus sign. :)
 
thanks..

thanks stonkie...but I guess you did'nt understand my problem. :)
My problem is I want to set the negative number format of textbox in Vista whenever I set the "RightToLeft" property of it to "Yes".:)
 
i think stonkie's right. Your vista system is set to put - sign there when right to left is true, why are you trying to defy an established convention?
 
:confused:
ooooppppss i did'nt mean to do that.. i really really sorry..:(
is it like that???? sorry again...
i just want to tell him that i GUESS he did not gets the situation...
The situation is the both System are properly set the Regional Settings to "right negative number" format but in Vista when you set the textbox property "RightToLeft" the negative also set to right..But I want to set to left whenever I set the property of textbox "RightToLeft" to right..

I hope someone understand me...:(

i'm not defying any convention.....:(
 
I don't have any Vista computer to test that now so I don't know how it reacts to rtl settings... You can try calling the (-17.32).ToString() method to see how the system formats the number.

If that doesn't work as you wish, you may want to bypass this using a custom format like this :

VB.NET:
String result = Math.Asb(myNumber).ToString();
if (myNumber < 0) {
    if (rtl) {
        result = result + NumberFormatInfo.CurrentInfo.NegativeSign;
    }
    else {
        result = NumberFormatInfo.CurrentInfo.NegativeSign + result;
    }
}

You'll have to handle the format and parse events for the thing to work, but your data bindings should remain fine. It may be buggy for formats like parentheses to show negative numbers, etc...
 
Back
Top