Nasıl yapılır: Windows Forms NumericUpDown Denetimi ile Sayı Değerleri Ayarlama ve Döndürme
Windows Forms Windows değeri özelliği NumericUpDown tarafından Value belirlenir. Denetimin değeri için diğer herhangi bir özellikte olduğu gibi koşullu testler yazabilirsiniz. Özelliği ayar verdiktan sonra üzerinde işlem gerçekleştirmek için kod yazarak doğrudan ayarlayabilir veya Value ve yöntemlerini UpButton DownButton çağırabilirsiniz.
Sayısal değeri ayarlamak için
Kod veya kod içinde Value özelliğine bir değer Özellikler penceresi.
NumericUpDown1.Value = 55numericUpDown1.Value = 55;numericUpDown1->Value = 55;-veya-
Özelliğinde UpButton DownButton belirtilen miktara göre değeri artırmak veya azaltmak için veya yöntemini Increment çağırma.
NumericUpDown1.UpButton()numericUpDown1.UpButton();numericUpDown1->UpButton();
Sayısal değeri geri dönmek için
Kodda Value özelliğine erişin.
If NumericUpDown1.Value >= 65 Then MessageBox.Show("Age is: " & NumericUpDown1.Value.ToString) Else MessageBox.Show("The customer is ineligible for a senior citizen discount.") End Ifif(numericUpDown1.Value >= 65) { MessageBox.Show("Age is: " + numericUpDown1.Value.ToString()); } else { MessageBox.Show("The customer is ineligible for a senior citizen discount."); }if(numericUpDown1->Value >= 65) { MessageBox::Show(String::Concat("Age is: ", numericUpDown1->Value.ToString())); } else { MessageBox::Show ("The customer is ineligible for a senior citizen discount."); }