Search All Articles Submit your Website or Blog to A New Internet Library
Sunday, May 24, 2009
Rounding a number after decimal point using Vb script Format functions
Below is the function in the vbscript which will round the number up to two digits after decimal number.
<Script language="VBScript">
Function Roundnumber(Decnumber,numlength)
Roundnumber = FormatCurrency(Decnumber,numlength,,,0)
Roundnumber = FormatNumber(Decnumber,numlength,,,0)
End Function
</Script>
<Script language="JavaScript">
function roundnumjavascript(number,length)
{
document.getElementById('textBox1').value= Roundnumber(number,length)
}
</Script>
In HTML
<input type="text" id="textBox1"/>
<input type="button" id="btnround" value="Roundnum" onclick="roundnumjavascript(document.getElementById('textBox1').value,2);"/>
Subscribe to:
Post Comments (Atom)
Also Read other Top Articles
- JSON Serialization in VS 2008
- Implementing Forms Authentication in Silverlight Application.
- Making GridView Rows or Individual Cells Clickable and Selectable.
- Enabling browser back button for GridView Paging and Sorting in Ajax 1.1 and 3.5 (using Visual Studio 2005/ Visual studio 2008)
- How to pass values from User Control to Page or calling Page methods from User Control.
- What is WCF?
- New features in C# 4.0
- C# to VB.NET and VB.NET to C# online free converter tools.


No comments:
Post a Comment
Post your comments/questions/feedback for this Article.