NumberBox doesn't update the display text (VS.Net 2010, .Net 4, Windows 7).
Thanks jmcilhinney for presenting us with the component. It really serves a lot.
However, while working with it I bumped onto a bug that occurs while using the currency format. When you change the Format and Location (English- United States) of your O.S. to something else, the display text of the NumberBox doesn't get updated while building the solution at the design time as well as when the form is loaded. In order to be updated, you need to manually set focus to and loose focus from it.
For an example, try doing the following:
From Control Panel ensure the Format and Location of your O.S. are English (United States) and United States respectively. Now start a new VS.Net project. Drag a new NumberBox and a Button on a form and change the BlankMode and Format properties of the NumberBox to 'ConvertToZero' and 'c' respectively. The display text should be '$0.00'. Now change the Format and Location of the O.S. to English (United Kingdom) and United Kingdom respectively. See, that doesn't change the display text of the NumberBox. Clean the solution and build it; that still doesn't solve the purpose. Now run the application, when the form is loaded you can see the display text is still '$0.00' while it is supposed to be '£0.00'. It is only when you click in the NumberBox and loose focus by clicking on the Button that the display text is updated properly.
To test, I started debugging the NumberBox class by applying breakpoint to check if the format is literally set when the NumberBox is initialized. Surprisingly when the control flow comes to the DisplayNumber method, in the last line, the proper text (£0.00) is actually getting set to the NumberBox. But somehow it's not taking effect later.
I'm not pretty sure but I think there's a problem in the designer class of the form that hosts the NumberBox. Open the designer class (e.g. Form1.designer.vb) and check where the NumberBox is initialized in the InitializeComponent method. There you can see that the text of the NumberBox is set to '$.00' even if we have already changed the format now. I think as the display text was set to '$0.00' when we first created the NumberBox, it is kind of getting glued here. The designer is not updating any subsequent change for some reason.
I'm using this component in my application and it's already through midway. So I can't start it all over. Hence I would request you to kindly look into the matter and provide me with some help.
Regards!
Re: NumberBox doesn't update the display text (VS.Net 2010, .Net 4, Windows 7).
Quote:
Originally Posted by
priyamtheone
I'm using this component in my application and it's already through midway. So I can't start it all over. Hence I would request you to kindly look into the matter and provide me with some help.
I'll try to have a look at that over the weekend.
Numeric Text Box with Min and Max values
Hi,
Your control has very nice functionalities.
Did you add MinValue and MaxValue properties to bound the user input on a newer version ?
Best regards,
Eric.