winforms - C# Win Forms lose cursor position after event and thousandsSeparator -
i have problem numericupdown. when set thousandsseparator true, , try use keypress event lose cursor position. cursor moves forward after write fourth number. example:
press 1 [ 1<here coursor>,00] press 2 [ 12<here coursor>,00] press 3 [ 123<here coursor>,00] press 4 [ <here coursor>1 234,00]
i see question unclear here code:
form initalicecomponent:
this.numericupdown1 = new system.windows.forms.numericupdown(); this.numericupdown1.keypress += new system.windows.forms.keypresseventhandler(this.numericupdown1_keypress); this.numericupdown1thousandsseparator = true;
numericupdown1_keypress:
textbox1.text = numericupdown1.value.tostring();
example of use: numericupdown shows 0,00. then, when press numbers 12345:
1,00 12,00 123,00 1 234,00 51 234,00 <-this should 12 345,00, cursor position moves forward
after set this.numericupdown1thousandsseparator = false, ok.
Comments
Post a Comment