I am making a simple unit converter, and wanted the user to specify the number of decimal places to be displayed for the results.
The user selects which conversion they want to perform from another combo box, and I have a select case to decide the calculation needed. Eg.
Select Case cboUnitType.SelectedIndex Case 0 'grams to ounces lcUnit2 = lcUnit1 * CSng(0.00220462262) lblUnitResult.Text = CStr(lcUnit2) Case 1 'ounces to grams lcUnit2 = lcUnit1 / CSng(0.00220462262) lblUnitResult.Text = CStr(lcUnit2) Case 2 'kilograms to stones
Everything works fine here, but I am unsure how to use another combo box to change the decimal places of lblUnitResult.
I have tried
lblUnitResult.Text = Format(lcUnit2, "0.00")
and variations of this but it doesn't seem to work.
Any help would be grand.