提交当前本机整理版本
This commit is contained in:
@@ -74,4 +74,39 @@ namespace Lskj.PubBill
|
||||
}
|
||||
|
||||
|
||||
bool Is
|
||||
bool IsDigitsOnly(string input)
|
||||
{
|
||||
foreach (char c in input)
|
||||
{
|
||||
if (!char.IsDigit(c))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void txtEdit_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
string text = this.txtEdit.Text;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(text)) return;
|
||||
|
||||
if (!this.IsDigitsOnly(text))
|
||||
{
|
||||
MessageUtil.Show("请输入数字");
|
||||
}
|
||||
if (int.Parse(text) > 0)
|
||||
{
|
||||
this.Quantity = int.Parse(text);
|
||||
this.Close();
|
||||
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show("请检查输入数量");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user