[英]How to accept only numeric value in XtraInputBox and how can I check which button has been clicked?
我有在單擊按鈕時觸發的代碼:
private void btnDown_Click(object sender, EventArgs e)
{
XtraInputBoxArgs args = new XtraInputBoxArgs();
args.Caption = "Quantité";
args.Prompt = "Entrez la quantité";
args.DefaultButtonIndex = 0;
args.DefaultResponse = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Quantité Restante");
var result= XtraInputBox.Show(args);
}
我想接受數值和退格鍵(防止用戶在TextEdit中輸入字母和特殊字符)。
如何查看單擊了哪個按鈕?
我從Dmitry Tor獲得解決方案(DevExpress支持)
private void button1_Click(object sender, EventArgs e)
{
TextEdit textEdit = new TextEdit();
textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
XtraInputBoxArgs args = new XtraInputBoxArgs();
args.Caption = "Quantité";
args.Prompt = "Entrez la quantité";
args.DefaultButtonIndex = 0;
args.DefaultResponse = "Test";
args.Editor = textEdit;
var result = XtraInputBox.Show(args);
if (result != null)
MessageBox.Show("Ok button pressed");
else
MessageBox.Show("Cancel button pressed");
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.