private void TextBoxInput_Leave(object sender, EventArgs e) { MetroTextBox txt = (MetroTextBox)sender; if (!string.IsNullOrEmpty(txt.Text)) { if (Convert.ToDecimal(txt.Text) <= 0) { Form frm = txt.FindForm(); MessageBox.Show("จำนวนต้องไม่ว่าง และ มากกว่า 0", "จำนวนตัวเลข", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txt.Text = "1"; txt.Focus(); } else { //MessageBox.Show("จำนวนสินค้าต้องมากกว่า 0", "จำนวนสินค้า", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("จำนวนต้องไม่ว่าง", "จำนวนตัวเลข", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }