Sunday, February 11, 2007 9:12 PM
OK...the NumberBox user control is ready for BETA TESTING....
Also important NOTE: For use with Visual Studio 2005 .NET Framework v2.0.50727
So you say you need a control like the textbox that will only accept numeric input...
You want it to format it how?
You want it to be able to accept math expression!
AND you want it to evaluate those math expressions....
Give it a spin and put it through the grinder and let me know what comes out!!!!
The NumberBox control is a user control with a single textbox control. At its very basic setup the NumberBox control is used to restrict the user to inputting only valid numeric entries (0-9 and the local decimal separator). By setting the properties of the NumberBox control it is possible to allow the user to input mathematical expressions evaluate them and also apply a custom format to the output.
Constructor: Public Sub New()
Initializes the textbox control, accessibility currently set to friend
Sets the NumberFormatInfo property to the current culture number format
Pass through properties: By setting any of the following control properties the properties of the textbox are changed:
Will evaluate a mathmatical expression
param name="Expression">the string containing the math expression to be evaluated, if a valid statement it returns the answer else returns 0
Sets focus to the NumberBox control and puts the cursor at the right
- SelectionStart Gets or sets the cursor point of the numberbox
- Text Gets or sets the text value of the numberbox - Useful for getting and setting math expressions
- CustomFormat Custom format to be applied when Format property is set to custom (ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxfund/html/6f74fd32-6c6b-48ed-8241-3c2b86dea5f4.htm or http://msdn2.microsoft.com/en-us/library/0c899ak8.aspx )
FormatOnEnter Apply Format when Numberbox has focus and enter key is pressed
Format Type of formatting to be applied - NumberBox Format enumeration
(ms- help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxfund/html /580e57eb-ac47-4ffd-bccd-3a1637c2f467.htm or http://msdn2.microsoft.com/en-us/library/dwhawy9k.aspx )
- AllowMath Allows basic math symbols to be entered in the numberbox restricts alpha characters from being entered
AllowFunctions Allows All Alpha Numerics to be entered in numberbox. If AllowFunctions is set to true AllowMath automatically gets set to true. With only AllowMath set to true only the digits 0-9, local decimal seperator and the math symbols are valid entries. If both are set to false only 0-9 and the decinmal seperator are valid entries.
EvaluateOnEnter The expression in the numberbox will be evaluated on enter when the numberbox has focus. Note: correct function syntax must be used. If the expression can not be parsed or evaluated then 0 is returned. Also variable expressions and variable substitutions are will not be evaluated. Example: Valid Input Sin(90)*(9!+3)/4 – 2^5 + ln(3) -however the following is not valid (a+1)
Number Gets or Sets the numeric value of the numberbox
NumberFormatInfo Gets or sets the number format info. Initialy set to the local culture number format
Sine – sin(x)
Arccosine – arccos(x)
Sqaure Root- sqrt(x)
Natural logarithm- Log(x)or ln(x)
Base 10 logarithm- log10(x)
Round – round(x)
Round – roundxy(x,y)
Absolute Value- abs(x)
Greatest Common Factor – gcf(x,y)
Supportted Math Symbols:
(, ), *, ^, +, -, /, !, =, pi, e
Contains Setup.exe and Setup.msi...the setup files will install the NumberBox.dll assembly in the GAC and to
Program Files\Duran\Control Libraries. It will also install a test project called NumberBoxTest located: Program Files\Duran\Control Libraries\NumberBoxTest. Once installed the NumberBox user control is available for selection from the Tool box choose items menu. And the test project will be available from your programs menu.
Monday, February 12, 2007 1:42 PM
I've not see the code yet but I'm wondering why you create a User Ctrl instead of a component that will override only certain methods or properties??
Monday, February 12, 2007 2:52 PM
Biche wrote: I've not see the code yet but I'm wondering why you create a User Ctrl instead of a component that will override only certain methods or properties??
First....every control is a component...although visa versa is not true....
a couple of notes from:
Class vs. Component vs. Control
If your class is neither designable nor holds external resources, you do not need an IComponent or an IDisposable type.
...A control is a component that provides (or enables) user-interface (UI) capabilities.
Now if you are asking why I didn't make all of the textbox properties available to the developer...it is because it is targeted for beginners and ease of use
Tuesday, February 20, 2007 2:32 PM
Do you have just the control which doesn't install itself in the GAC?
Tuesday, February 20, 2007 3:31 PMI will post it (NumberBox.dll) for you this evening
Tuesday, February 20, 2007 11:29 PM
Hey SJ...There is a new download "Just the dll"
Thursday, February 22, 2007 11:21 PMGot it, thanks - I'll play with that puppy later: computer woes at the moment...