windows - Allow only Decimal Value -


in window textbox, i'd allow decimal only.

for example, 8.56

how to?

you can using double.tryparse.

you can check input on submit button below mentioned ways.

            double m = 0;              if (double.tryparse(textbox1.text, out m) == false)             {                 messagebox.show("please enter valid price");                 textbox1.focus();             }             else             {                 // put code here             } 

Comments