An implementation of Visual Basic that is built into Microsoft products.
Thanks for reaching out!
The problem is not with your decimal button code.
The issue happens because the calculator is
- Treating the input values as text instead of numbers, or
- Converting them to an integer data type, which removes the decimal portion.
Below are some steps which are helpful to solve the issue
- Make sure all variables used in calculations are defined as Double, not Integer.
- Before calculation, explicitly convert textbox input to numbers using
CDbl(). - Perform calculation using Double type
- Ensure display formatting, for output to show decimals
Please let us know if you require any further assistance, we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer". So that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.