Tuesday, July 7, 2009

numericupdown trouble do not show decimal value.

private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
string value = numericUpDown1.Value.ToString();
int numOfDecimalPlaces = 0;

if (value.Contains("."))
{
string[] splitString = value.Split(new char[] { '.' });
numOfDecimalPlaces = splitString[1].Length;
}

numericUpDown1.DecimalPlaces = numOfDecimalPlaces;
}

ref : http://www.dreamincode.net/forums/showtopic81889.htm

No comments:

Counter