简体   繁体   中英

NumericUpDown c#

I have a problem with NumericUpDown control.

in the winForm code:

this.passwordLength = new NumericUpDown();
this.passwordLength.Location = new System.Drawing.Point(304, 11);
this.passwordLength.Margin = new System.Windows.Forms.Padding(2);
this.passwordLength.Maximum = new decimal(new int[] {128,0,0,0});
this.passwordLength.Minimum = new decimal(new int[] {1,0,0,0});
this.passwordLength.Name = "passwordLength";
this.passwordLength.Size = new System.Drawing.Size(41, 20);
this.passwordLength.TabIndex = 2;
this.passwordLength.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.passwordLength.Value = new decimal(new int[] {12,0,0,0});
this.passwordLength.ReadOnly = false;

Am I right that the last one "ReadOnly" property should allow the client to enter the value manually not only by arrow keys or clicking on the arrows by the textbox?

That is exactly what I want. But it's not working with code above. If ReadOnly not mentioned at all, editing by writing into the textbox is not possible, the goal is to make it Possible!

Thanks

ReadOnly makes it so you can't interact with it. Have you looked trough your default properties. by right clicking the numeric.

if not try to delete it and create a new numeric. then copy and paste the code.

because it works for me.

ReadOnly is indeed the property that defines if a value can be entered manually, or only using the buttons. The code should work, so i think the problem lies elsewhere

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM