Domanda

I am new to C# Here i am using masked textbox and set the mask as 00.0. And in database respective field is stored in decimal(3,1) while retrieving to masked text box it will give inaccurate values if i stored 12.3 , 23.8, 45.7 these type of values i got solution But instead of these if we use 1.3 , 3.5, 5.6 i got in my masked text box as 13.0, 35.0, 56.0 .... how to handle this exception? sorry..! for my bad English advance thanks

È stato utile?

Soluzione

While setting back the MaskedTextBox, try converting the decimal value according to some format:

maskedTextBox1.Text = value.ToString("0#.#");

This way you will get 01.3 instead of 13.0

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top