How to input a decimal ex. 1,234.56 in a textbox
tnx
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhijit PatilPosted Feb 9, 2014, 10:52 PM
the textbox have not that type of facility to get only digit.but you can validate the textbox using keypress event of this textbox.
see below code
if(char.IsDigit(e.KeyChar)==false && Convert.ToInt32(e.KeyChar)!=8)
{
MessageBox.Show("Enter Numeric Only");
e.handled=true;
}
it can take only digit ,now we need to validate as per your requirment like if u enter
123456
then it can get value as 1,234.56
for that you can import namespace as System.Globalization;
and write down the following code
Abhijit PatilPosted Feb 10, 2014, 8:27 AM
Cris AbellaPosted Feb 10, 2014, 7:54 AM
Praveen NPosted Feb 9, 2014, 10:49 PM
Could you please be clear with your question ?
Regards,
Praveen Nelge