c# - cursor moves to left when typing in numericupdown -


i have numeric down has value.when changing value keyboard , after clicking of first key cursor moves left entered value.ex. if entering '1' cursor moves left '1' not right '1'.

i have done code on value changed event.

 private void txtpendingamount_valuechanged(object sender, eventargs e)         {             try             {                 string result = string.empty;                 if (decimal.parse(txtamtdue.text, numberstyles.currency | numberstyles.number) == 0)                 {                     result = calculateamount(decimal.parse(txtamount.text == "" ? "0" : txtamount.text, numberstyles.currency | numberstyles.number), decimal.parse(txtpendingamount.value.tostring() == "" ? "0" : txtpendingamount.value.tostring(), numberstyles.currency | numberstyles.number));                 }                 else                 {                     result = calculateamount(decimal.parse(txtamtdue.text == "" ? "0" : txtamtdue.text, numberstyles.currency), decimal.parse(txtpendingamount.value.tostring() == "" ? "0" : txtpendingamount.value.tostring("c"), numberstyles.currency));                 }                 if (result == "invalid")                 {                     txtremamt.text = "0.00";                 }                 else                 {                     txtremamt.text = convert.todecimal(result).tostring("c");                 }             }             catch (exception ex)             {                 cusexception cex = new cusexception(ex);                 cex.show(messageboxicon.error);             }         } 

how can solve problem> stuck here .any appreciated. thanks

i think problem when accessing value, text evaluated, reason adjusts text , cursor moves.

maybe try , access text, not value. had similiar problem (in textchanged handler though) , instead of access numericupdown1.value, decimal.parse(numericupdown1.text) , stops moving cursor.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -