Restricting the numbers of digit after decimal is very small code but it has very important role in coding for any program specially related in mathematical calculation and also in financial programming. Suppose one wants to divide 5 by 9 the correct answer will .55555555555555........ and if he wants to restrict the 2 or 4 digits after decimal then the answer will be .55 or .5555.

To achieve this result the VB.Net code will be " Math.Round(result, number of digits)"

Dim percent, row, counter As Double

percent = val(txtNo1.text)

counter = val(txtNo2.text)

row = counter / percent

Label12.Text = Math.Round(row, 2)

The above code will restrict the 2 digits after decimal and if one wants to increase the number of digits after decimal just change the 2 to any integer number.